char 128? no... 256

Irmen de Jong irmen at
Wed Feb 12 14:40:13 CET 2003

Afanasiy wrote:
> 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 can only encode a Unicode string to ASCII if it contains
7-bit clean ASCII characters ONLY.
Your string apparently contains characters that are not
present in the ASCII character set, and thus it's
impossible to encode your string into ASCII!

You shouldn't try to use ASCII, choose a character set
that *does* contain your special character.
(parhaps ISO-8859-1 ?)


More information about the Python-list mailing list