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

Recommended Answers

All 5 Replies

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.

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

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.

# 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?

When I exceed \u00ff I just get a question mark character, no error. Let me know how you fare with this.
Shalom!

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

Well I'm back sooner than I expected and vegaseat, you have solved my problem. :D

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.