[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] unicode two-way conversion
From:       Mateusz Korniak <mateusz () ant ! gliwice ! pl>
Date:       2005-10-25 10:28:41
Message-ID: 200510251228.41942.mateusz () ant ! gliwice ! pl
[Download RAW message or body]

On Tuesday 25 of October 2005 12:13, Sebastian Kügler wrote:
> Hi,
>
> (I'm posting to this list since I think it's likely that someone here ran
> across the same problem.)
>
> I'm working on a database frontend for a postgresql database, and I'm
> having an issue with unicode characters that I've put into the Qt UI.
>
> When I read the data from the widget, I'm not able to insert strings into
> the database using unicode. I can replace the offending characters with
> 'string'.encode('ascii', 'xmlcharrefreplace').

Encode to (and back from) utf-8.
Remember only that utf-8 representation is longer than number of chars in 
unicode string if any non 7bit ascii char is used.
Also make sure that Yours DB iface allows to use 8bit encoding (like 
iso-8859-1/2).

> So what I basically need is a two-way conversion between unicode strings
> and ascii (or at least something that is easily usable together with
> psycopg and postgres' character fields.
>
> Attached scriptlet should show that problem.

Another solution (and prolly better) to You, may be to create unicode 
Postgresql database and do not care about encoding anymore at all.

-- 
Mateusz Korniak
"Black holes are where God divided by zero." - Steven Wright

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic