[PyQt] binary file viewer with textEdit (PyQt)

sandokan xproch13 at seznam.cz
Thu Jun 24 12:20:50 BST 2010

Mark Summerfield-4 wrote:
> One thing that slows QTextEdit down is its sophisticated layout engine.
> If you can live without that and use a QPlainTextEdit you should get
> some speedup straightaway.

Wow, this works perfectly fine. However, I still have a problem with binary
file representation in a text field. Zeros (00h) are not visible at all
(zeros are not represented by white space as expected). So for example:
"2E 64 6C 6C 00 4F 4C 45" (in hex)
should be represented as:
".dll OLE"
but is represented as:

Maybe its because of chosen encoding but "mbcs" was only one which could
displayed binary file in QTextEdit at all:
s = codecs.open(self.filename,'rb','mbcs').read()

Do you know any other encoding for binary files which could be used and
handled correctly by QTextEdit or should I change my approach completely and
try to display binary files other way?

View this message in context: http://old.nabble.com/binary-file-viewer-with-textEdit-%28PyQt%29-tp28962175p28981436.html
Sent from the PyQt mailing list archive at Nabble.com.

More information about the PyQt mailing list