| | |
Python and Unicode
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
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
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
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!
[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!
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
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
![]() |
Similar Threads
- Help needed for displaying extended charactors in Tk() (Python)
- Handling unicode values in python. (Python)
- Handle unicode characters (Python)
- Running Python (Python)
- Inserting Unicode Characters into a List (Python)
Other Threads in the Python Forum
- Previous Thread: tuple or list?
- Next Thread: Inserting Unicode Characters into a List
| Thread Tools | Search this Thread |
abrupt ansi anti approximation assignment avogadro backend beginner binary bluetooth calculator character cmd code customdialog decimals dictionaries dictionary directory drive dynamic error examples excel exe file float format function gnu graphics gui heads homework http ideas import input java launcher leftmouse line linux list lists logging loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyqt python random recursion schedule scrolledtext sqlite statistics stdout string strings sudokusolver sum table terminal text thread threading time tkinter tlapse tricks tuple tutorial twoup ubuntu unicode update urllib urllib2 variable ventrilo wikipedia windows write wxpython xlib






