compile(unicode) & source encoding

Martin v. Löwis martin at v.loewis.de
Fri Nov 28 16:30:29 EST 2003


"Denis S. Otkidach" <ods at strana.ru> writes:

[In the context of compile()]
> 1. What is the reason to encode source code to utf-8?

I think it is because Just found that the most straight-forward thing
to do: UTF-8 supports all Unicode characters, and you have to choose
*some* encoding, as the resulting byte strings need to be encoded
somehow.

In addition, anybody desiring a different encoding can explicitly
invoke .encode()

> 2. Why there is now option to define encoding of source passed to
> compile function?

No, although this should be implemented. It is not implemented at this
point because it is very hard to do, and I have not found a good way
to do it, yet.

Regards,
Martin




More information about the Python-list mailing list