View Full Version : 8-bit params for QProcess

28th August 2015, 13:18
I have an app that must be launched with ASCII params. It treats them as an array of bytes so it must be ASCII and not UTF-8 etc. The values may be non-latin (so it's not a real ASCII, but any of codepages like CP-1251).
In bash I can launch it as

myapp --myparam $'abc...Z\xC0\xC1...\xFF'
I can't find a way to do this with QProcess...
It seems to not use bash and launch processes directly, so I can't use $'\xnn' syntax (http://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html).
It also doesn't accept params in form other than QString. And there is no way to ask it to do QString::toLocal8Bit() before passing params to the app (so I could use QTextCodec::setCodecForLocale() to spoof UTF-8 with other codepage).

Any ideas?

Added after 1 49 minutes:

I've realized that QProcess apply QFile::encodeName() to each arg so the problem may be bypassed with QTextCodec::setCodecForLocale(). Case closed.