Python and Unicode

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jun 2005
Posts: 8
Reputation: iacobus is an unknown quantity at this point 
Solved Threads: 0
iacobus's Avatar
iacobus iacobus is offline Offline
Newbie Poster

Python and Unicode

 
0
  #1
Jun 16th, 2005
Hi all,
I am trying to learn unicode relative to Python, but to be honest, I'm floundering a whole lot.
I have never had so much trouble with anything before, but to put it simply, I just don't get it.
For example, I want to use Hebrew words in my Python program.
But no matter what I do,
I get the error about unsupported characters.
So is there anything I can do to get Python to support those characters?
Please keep it simple, 'cause my brain isn't up to it.

Thanks

Iacobus
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,070
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 938
Moderator
vegaseat's Avatar
vegaseat vegaseat is online now Online
DaniWeb's Hypocrite

Re: Python and Unicode

 
0
  #2
Jun 17th, 2005
Python, being a rather international programming language has unicode handling built in, but your much more local operating system might not be so international and rudely stop after the first 256 characters.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 8
Reputation: iacobus is an unknown quantity at this point 
Solved Threads: 0
iacobus's Avatar
iacobus iacobus is offline Offline
Newbie Poster

Re: Python and Unicode

 
0
  #3
Jun 18th, 2005
To vegaseat,

Thanks for the reply.

No, my OS is quite capable of handling languages. I can write in Hebrew with no problems, and view many different language websites.

My problem is, I just don't know how to write Hebrew using the Python prgram. :cry:

Iacobus
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,070
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 938
Moderator
vegaseat's Avatar
vegaseat vegaseat is online now Online
DaniWeb's Hypocrite

Re: Python and Unicode

 
0
  #4
Jun 18th, 2005
I am sorry that I don't know any Hebrew characters, but I have done this little example for Spanish characters. Try something similar with the values for Hebrew characters.
[php]# here I used the unicode \uxxxx where xxxx is a four digit
# hexadecimal number to put in two typical Spanish characters
# 00bf = ¿ and 00f3 = ó that are not on my US keyboard
a = u'\u00bfC\u00f3mo es usted?'
print a
# result is ¿Cómo es usted?
[/php]When I exceed \u00ff I just get a question mark character, no error. Let me know how you fare with this.
Shalom!
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 8
Reputation: iacobus is an unknown quantity at this point 
Solved Threads: 0
iacobus's Avatar
iacobus iacobus is offline Offline
Newbie Poster

Re: Python and Unicode

 
0
  #5
Jun 19th, 2005
Mucho gracias vegaseat,

I will try later today after things settle down here a bit.

I'll post back to let you know how it came out.

Thanks!!!!

Iacobus
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 8
Reputation: iacobus is an unknown quantity at this point 
Solved Threads: 0
iacobus's Avatar
iacobus iacobus is offline Offline
Newbie Poster

Re: Python and Unicode

 
0
  #6
Jun 19th, 2005
Well I'm back sooner than I expected and vegaseat, you have solved my problem.

I can now effectively (I hope) write the needed characters. The secret was the 2nd "U". I was only entering one of them and not entering the second one in the hex number. Dum-de-dum-dum! (Or should that be "dumb-de-dumb-dumb"?):rolleyes:

I am grateful for you time and consideration, for sure.

Iacobus
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC