'strings in hebrew in python for s60

I'm using python for S60. I want to use string in hebrew, to represent them on the GUI and to send them in SMS message. It seems that the PythonScriptShell don't accept such expressions, for example:

u"אבגדה"

what can I do? thanks

development of situation: I added the line:

# -*- coding: utf-8 -*-

as the first line in the source file and in notepad++ I selected: Encoding>>Convert to utf8.

now, the GUI appears in Hebrew but when I selected an option the selection value cannot be compared to a string in Hebrew in the code (probably) and there is no response.

On PythonScriptShell appears the warning:

Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal.

Help me, please.



Solution 1:[1]

I just tested this in both bluetooth and on-phone consoles with PyS60 2.0, and non-ASCII unicode was handled w/out exceptions.

If you have that string in the file rather than passing it in the console, error is caused by lack of encoding specification in the file.

Add # -*- coding: utf-8 -*- as first line there.

Solution 2:[2]

convert your words to unicode characters using unichr eg unichr(1507) for char ?

refer to the decimal values in this table: http://www.ssec.wisc.edu/~tomw/java/unicode.html#x0590

Solution 3:[3]

Add up ru = lambda txt: str(txt).decode('utf-8','ignore')

And add the function before each text use ru("?????")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel Kluev
Solution 2 Christian Smorra
Solution 3 mordi