I have a file where I want to write/ append unicode data to, because it is already unicode data (created by WMIC file output). It starts with UTF-16 (LE) BOM: 0xFF 0xFE.
I'd like to append some information in a loop:
QString line = QString("%1,%2,%3,%4\n")
.arg( node )
.arg( *it )
.arg( sDisplayName )
.arg( sDisplayVersion );
out.write( line.toLatin1().data() );
Where:
QFile out;
out.setFileName(filename);
I have tried different things. I thought QStrings themselves where Unicode. But I think I am missing something -- like setting the Encoding. It seems my appended characters are written as ASCII (only taking one byte each).
Thanks for your help!
Cheers Matthias
Edit: ok maybe the problem is also Latin1 <-> UTF-16?