![]() |
Inputting Non-ASCII Characters
More specifically, the characters in the extended ASCII set.
Admittedly, I've only tried raw_input(), but that's the only method I know except file input, to which I'm trying to avoid resorting. Whenever I input a character in the extended ASCII set (say, "æ"), I get a UnicodeEncodeError exception. Google has not helped me much, as I am only able to find descriptions on how to use foreign characters in the Python file itself, which is of no use to me. Thanks for any help, if you have any. |
First of all read up on unicode at:
http://www.python.org/peps/pep-0263.html Also here is a small code sample I wrote a while ago that might help you in your quest: :
# Python supports Unicode strings whose individual characters |
That's not what I was asking for. I already know that and use it extensively in my programme, though I'm looking for a way to get unicode input from the user.
On a related note, though, I tried using some Cyrillic characters (not even outputting them on the display, simply storing them in a variable), let's say Б (or \ud091), but my IDE, ActivePython gives me the following error: UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 1-5: truncated \uXXXX escape Surely, this shouldn't happen. It won't let me run the programme, even. It just displays this when I run that error-check on the .py file. Edit: I found the problem with the Cyrillic characters, which was a fairly silly typo. |
Quote:
|
It may be that it's just ActivePython that's messing up.
|
| All times are GMT -5. The time now is 1:44 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC