toLocal8Bit() is definitely not what you want to use here. It's undefined for characters not in the local 8-bit codepage and as the name implies behavior will vary depending on the local encoding. See http://qt-project.org/doc/qt-4.8/qstring.html#toLocal8Bit . Using toUTF8 instead seems like the right thing to do.