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

List:       pykde
Subject:    Re: [PyKDE] unicode two-way conversion
From:       rajeev_jsv () dinamis ! com
Date:       2005-10-26 2:28:00
Message-ID: 200510260746.00431.rajeev_jsv () dinamis ! com
[Download RAW message or body]

On Wednesday 26 October 2005 2:57 am, Sundance wrote:
> I heard Sebastian Kügler said:
> > 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.

from Unicode to 8Bit (UTF-8)
--
someStr = unicode(QString("hello"))
eightBitStr = someStr.encode('utf-8')


from 8Bit (UTF-8) top Unicode
--
read8Bit = <get the string>
unicodeStr = read8Bit.decode('utf-8')
qString = QString(unicodeStr)


eg. Pasted from Konsole
--
>>> smeStr = str('൱')
>>> smeStr.decode('utf-8')
u'\u0d71'


Rajeev J Sebastian

_______________________________________________
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