[Python-Dev] PEP 263 considered faulty (for some Japanese) (original) (raw)
M.-A. Lemburg mal@lemburg.com
Wed, 13 Mar 2002 13:44:16 +0100
- Previous message: [Python-Dev] PEP 263 considered faulty (for some Japanese)
- Next message: [Python-Dev] PEP 263 considered faulty (for some Japanese)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Fredrik Lundh wrote:
mal wrote: > The PEP says: > """ > The builtin compile() API will be enhanced to accept Unicode as > input. 8-bit string input is subject to the standard procedure > for encoding detection as decsribed above. > """ so if you pass in a Unicode string, any "coding" declaration is ignored?
Right.
> so the problem of decoding source code input to compile() > is shifted into the application space.
in other words, something like this should work: stream = makehttprequest(...) body = stream.read() charset = stream.getheader("content-type", "charset") if charset: body = unicode(body, charset) code = compile(body, ...)
Yes.
-- Marc-Andre Lemburg CEO eGenix.com Software GmbH
Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/
- Previous message: [Python-Dev] PEP 263 considered faulty (for some Japanese)
- Next message: [Python-Dev] PEP 263 considered faulty (for some Japanese)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]