944,183 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 5046
  • Python RSS
Jun 16th, 2005
0

Python and Unicode

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
iacobus is offline Offline
8 posts
since Jun 2005
Jun 17th, 2005
0

Re: Python and Unicode

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.
Moderator
Reputation Points: 1333
Solved Threads: 1404
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Jun 18th, 2005
0

Re: Python and Unicode

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
iacobus is offline Offline
8 posts
since Jun 2005
Jun 18th, 2005
0

Re: Python and Unicode

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!
Moderator
Reputation Points: 1333
Solved Threads: 1404
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Jun 19th, 2005
0

Re: Python and Unicode

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
iacobus is offline Offline
8 posts
since Jun 2005
Jun 19th, 2005
0

Re: Python and Unicode

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
iacobus is offline Offline
8 posts
since Jun 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: tuple or list?
Next Thread in Python Forum Timeline: Inserting Unicode Characters into a List





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC