Re: troubles with unicode

Oleg Broytman <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <[email protected]>
On Sun, Jan 29, 2012 at 09:50:01PM +0100, Petr Jake?? wrote:
>  ============= set method start ===============
> <type 'str'> telKontaktniOsoby <type 'unicode'> +420721870631
> <type 'str'> kontaktniOsobaPrijmeni <type 'unicode'> Kra??mar
> <type 'str'> nazevKontaktMistaPoruchy <type 'unicode'> Vr??tnice
[snip]
> ============ _SO_update start =====================
> <type 'str'> tel_kontaktni_osoby <type 'str'> +420721870631
> <type 'str'> kontaktni_osoba_prijmeni <type 'str'> Kra??mar
> <type 'unicode'> nazev_kontakt_mista_poruchy <type 'unicode'> Vr??tnice
[snip]

   .set() converts fields to backend format using validators attached to
the fields. UnicodeColumns are encoded to strings, but StringColumns are
not, so when you've assigned a unicode object to a StringCol
._SO_update() received that unicode object which is wrong -
._SO_update() has to receive str. Do not assign unicode to StringCol.

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            [email protected]
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.