[Zope] Re: unicode and zope
Andrew Altepeter
aaltepet at bethel.edu
Wed Feb 4 11:16:41 EST 2004
Hi Toby,
> On Wednesday 04 February 2004 15:18, Andrew Altepeter wrote:
> > (bringing this back on the list...)
> >
> > Hi Shan,
> >
> > It appears that the steps you outlined have solved my issue(s) too.
>
> You've probably swapped your original problems for a set of different ones.
I had a feeling that this wasn't an 'approved' way to go...
What kinds of problems?
>
> This does make some things easier so I understand the temptation to use it,
> but it is not a supported configuration for Zope or python :-(
Thanks for the warning.
> > When the form is submitted
> > with these unicode characters in it, my script raises a UnicodeError
> > when ZMySQLDA apparrently attempts to change the encoding to ascii.
>
> add a :utf8:ustring marshalling tag on the end of your field, and your
> variable will hold a unicode object.
>
> unicode objects have a .encode() method, which will be useful if your database
> adapter needs an 8-bit string.
I think zmysqlda needs an 8-bit string? It seems to, because
zmysqlda.db.db (which is a mysql-python db object) raises the unicode
error.
The biggest problem with unicode I'm having are microsoft's m-dashes and
curly-quotes. So what you're saying is that if the input fields are
:utf8:ustring, then prior to saving them to database, if I did:
field.encode('latin-1')
Everything will work well? Or, will these unicode characters just have
8 bits removed?
Thanks so much for the advice; I'll look into changing how my input
fields are rendered.
Andy
More information about the Zope
mailing list