[PyKDE] unicode two-way conversion
rajeev_jsv at dinamis.com
rajeev_jsv at dinamis.com
Wed Oct 26 03:16:00 BST 2005
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
More information about the PyQt
mailing list