[PyQt] problems with QTextBrowser

Aaron Digulla digulla at hepe.com
Wed Apr 16 10:46:26 BST 2008

Quoting Dusan Zatkovsky <msk.conf at seznam.cz>:

> I have tried "print repr ( html )" and it prints strange charracters (
> <\x00h\x00t\x00m\x00l\x00>\x00<\x00h ... ). Couldn't be problem there?

Yup. The 0-byte (\x00) is the "end of text" character. The zero bytes  
come from unicode. It seems that you store the text as "Unicode 16bit  
little endian" in the database.

To fix this, use the codec module of python to convert the unicode to  
UTF-8. This will also make the HTML take half the amount of bytes in  
the database.


Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."

More information about the PyQt mailing list