Anyway to designating the encoding of the "source" for compile?

Serge.Orlov at gmail.com Serge.Orlov at gmail.com
Tue May 17 03:07:49 EDT 2005


janeaustin... at hotmail.com wrote:
> Thank you but there is still a problem.
>
> |>>> s='euckr="\xc7\xd1";uni=u"\xc7\xd1"'
> |>>> su=s.decode('euc-kr')
> |>>> su
> |u'euckr="\ud55c";uni=u"\ud55c"'

su[7] is a non-ascii character inside the byte string euckr

> |>>> c=compile(su,'','single')
> |>>> exec c
> |>>> euckr,uni
> |('\xed\x95\x9c', u'\ud55c')
> |>>>
>
> As you see the single's result is turned into UTF-8 encoding.

See my previous message. Non-ascii characters in byte strings
are deprecated.

  Serge.




More information about the Python-list mailing list