char 128? no... 256

Andrew Bennetts andrew-pythonlist at puzzling.org
Wed Feb 12 00:20:33 EST 2003


On Wed, Feb 12, 2003 at 04:53:52AM +0000, Afanasiy wrote:
> on tue, 11 feb 2003 20:47:37 -0800, erik max francis <max at alcyone.com>
> wrote:
> >
> >You're saying they're just "extended ASCII foreign characters," but this
> >doesn't mean anything without specifying the encoding.
> 
> I obviously need to be able to decode the Unicode object.
> The sad part is, this doesn't have have to be a Unicode
> object but Python decides to make it one. So I guess the
> solution is to stop using Python for this project.
> 
> >>> s = u'?'
          ^
          In this case, *you* are deciding it's unicode.
> >>> s
> u'\x94'
> >>> unicode(s,'latin-1')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: decoding Unicode is not supported
> >>>

Can you give an example where Python decides to make your 8-bit string
unicode?

-Andrew.






More information about the Python-list mailing list