char 128? no... 256

Roman Suzi rnd at onego.ru
Wed Feb 12 09:14:46 EST 2003


On Wed, 12 Feb 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. And as you can
> see, it cannot be decoded. So if I am getting a unicode object
> I have no way of converting it to ascii and am thus screwed.

You are trying to do impossible in principle. Unicode is much richer than
ASCII or even ASCII+national 8-bit encoding part. You must use some escape
(HTML-ones or Python-ones) to squeeze Unicode into simple string.

Can you please describe what problem are you solving in more
detail so we can help better.

Sincerely yours, Roman A.Suzi
-- 
 - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
 






More information about the Python-list mailing list