On Tue, Nov 10, 2009 at 04:43:54PM -0300, Mariano Mara wrote: > Hi, I'm facing the current situation and I don't know how to fix it. > What I want to do, of course, is to store unicode data, have unicode data > in the database and retrieve unicode data. But I don't know what I'm > missing.
Your code looks correct to me.
> If I try to store unicode data in the database, when I try to retrieve
> it all I get is garbage.
> A full example with paster shell (as you can see my database store
> garbage too):
>
> In [1]: x = model.Language()
>
> In [2]: x.id = u'es'
>
> In [3]: x.name = u'Español'
I see from the shape of your prompt that you're using IPython.
IPython has a bug where you cannot really input Unicode literals.
Try it:
$ ipython
In [1]: len(u'ñ')
Out[1]: 2 <--- WROOONG
$ python
>>> len(u'ñ')
1 <--- correct
The bug is reported upstream and might even be fixed in ipython's trunk.
Marius Gedminas
--
At most companies, programmers aren't trusted with words that a user might
actually see (and for good reason, much of the time).
-- Joel Spolski
signature.asc
Description: Digital signature
