PyQt Unable to correctly print Unicode from `QProcess.readAllStandardOutput()`
-
Hi,
I don't fully understand how Unicode transformation is done and I've seen some topics (they helped me a bit) like this one
But still I'm going to clarify one thing:I make a QProcess that should produce these symbols
ℯαΔ
.
Being more specific I make a call to julia programming language like this:self.qprocess.setProgram('julia.exe') self.qprocess.setArguments(['-E', '@info("ℯαΔ");']) self.qprocess.start() def onProcessReadyReadStandardOutput(self): print("QProcess output:\t", str(self.qprocess.readAllStandardOutput().data(), 'utf-8'))
The printed output is
[ Info: ea?
The same output I get when running the same code from Windows powershell.\julia.exe -E '@info(\"ℯαΔ\")'
I believe the output that I get from python is affected by the fact that Windows command line doesn't support Unicode. Is that right?
Is there a way to avoid that and produce correct output from python? -
@Please_Help_me_D said in PythonQt (PyQt) Unable to correctly print Unicode from `QProcess.readAllStandardOutput()`:
def onProcessReadyReadStandardOutput(self):
print("QProcess output:\t", str(self.qprocess.readAllStandardOutput().data(), 'utf-8'))Try
def onProcessReadyReadStandardOutput(self): print("QProcess output:\t", str(QString(self.qprocess.readAllStandardOutput()), 'utf-8'))
-
@Please_Help_me_D
Not my area, but there seem to be plenty of questions to look through from Googlingprint Unicode from QProcess.readAllStandardOutput()
? E.g. maybe https://stackoverflow.com/questions/41761132/pyqt-qprocess-readallstandardoutput-encoding helps? -
@JonB thank you for reply,
I tried googling that and tried to apply their solutions, but there was no way I could display alpha, beta, phi etc correctly.
Me neither I don't understand all that encoding staff. I only have some basic "knowledge" on that
-
(Just modified the title, because PythonQt is another project and for future readers, I hope they don't get it wrong when talking about PyQt)