char 128? no... 256

Eric Brunel eric.brunel at pragmadev.com
Wed Feb 12 09:20:57 EST 2003


Afanasiy wrote:
> On Wed, 12 Feb 2003 03:18:43 GMT, Afanasiy <abelikov72 at hotmail.com> wrote:
> 
> 
>>UnicodeError: ASCII encoding error: ordinal not in range(128)
>>
>>This isn't even unicode, it's extended ascii characters used in foreign
>>languages. I can't print them, or write them to file, etc... They are
>>normal chars. This really annoying, a str() around it doesn't even work.
> 
> 
> Replying to all these confused threads...
> 
> Yes I know I asked for a Unicode object in the example code.
> I am trying to emulate what Python is doing.

Can you please tell us where your string comes from? There are actually some 
well-known modules (e.g. Tkinter) that will return either a plain string or a 
unicode string depending on the user's input, but the case should be quite 
rare... And this has nothing to do with Python itself: it's just the way the 
module handles the strings. Python itself just does what it's told...
-- 
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com





More information about the Python-list mailing list