[Zope] Problems with unicode and other encodings.

Dieter Maurer dieter at handshake.de
Wed Nov 17 13:48:41 EST 2004


Alec Munro wrote at 2004-11-16 12:18 -0400:
> ...
>http://effbot.org/zone/unicode-gremlins.htm
>
>This article presents a way to convert these characters to Unicode,
>which seems to work quite well, in and of itself. However, if I
>retrieve database fields, convert them, and then attempt to reinsert
>them, with the unicode characters, I get a UnicodeEncodeError, because
>it is attempting to encode these characters as ascii before inserting
>them in the database.
>
>What are possible solutions to these problems?

Few systems are ready to store unicode directly.

Usually, you must choose an encoding when you want to store
unicode text. Thus, decide which encoding your database should
use. When you store unicode text, you use the chosen encoding
to encode the text; when you retrieve text from the database,
you use the encoding to convert back to unicode.

-- 
Dieter


More information about the Zope mailing list