How to get Python to default to UTF8
Fredrik Lundh
fredrik at pythonware.com
Sat Dec 22 01:49:46 EST 2007
weheh wrote:
> I'm developing a cgi-bin application that must be unicode sensitive. I'm
> striving for a UTF8 implementation. I'm running python 2.3 on a development
> machine (windows xp) and a server (windows xp server). Both environments are
> running Apache 2.2 with the same configuration file.
>
> The problem is this. On my development machine I get the following unicode
> error:
>
> UnicodeDecodeError: 'utf8' codec can't decode bytes in position 4-6: invalid
> data
> args = ('utf8', 'adem\xe3\xa1s', 4, 7, 'invalid data')
> encoding = 'utf8'
> end = 7
> object = 'adem\xe3\xa1s'
> reason = 'invalid data'
> start = 4
Could be that sys.stdin.encoding differs between the setups.
*Where* do you get this exception? In the database layer? When the
script is trying to read things from a file? When it's trying to output
things? Somewhere else?
</F>
More information about the Python-list
mailing list