python - Working with a QString encoding -
Is there a Python library that can detect the string encoding (and maybe decode)?
I found but it gives me an error:
chardet.detect (self.ui.TextFrom.toPlainText ()) found: = chardet.detect (self .ui.TextFrom.toPlainText ()) file .... U.F.D. (AIBUF) file ... if itself ._HiBiltDetter Search (FF): Type error: buffer size mismatch Also:
print type (self.ui.TextFrom.toPlainText ()) # & Lt; Class 'PyQt4.QtCore.QString' & gt;
Convert your QString to a python string Change it before going to chardet :
chardet.detect (self.ui.TextFrom.toPlainText ()) In:
Chardet.detect (str (self () ((self.ui.TextFrom.toPlainText ()))
Comments
Post a Comment