Hi.
I have all my data in Utf8, but now I have to save a file in Windows1250 code. How to conversion a data from utf8 to windows 1250 and save file in windows 1250 code?
Thaks
Hi.
I have all my data in Utf8, but now I have to save a file in Windows1250 code. How to conversion a data from utf8 to windows 1250 and save file in windows 1250 code?
Thaks
Have a look at QTextCodec in combination with QTextStream.
Horse sense is the thing that keeps horses from betting on people. --W.C. Fields
Ask Smart Questions
Could you give me an example, there is only examples to and from Unicode :/
Those are the exact examples you need. toUnicode() returns a QString (QStrings are unicode), fromUnicode() returns a QByteArray, which is your target encoding.
Horse sense is the thing that keeps horses from betting on people. --W.C. Fields
Ask Smart Questions
TomASS (9th February 2010)
Ok, thanks, and what with save file in windows 1250?
Now I have:
Qt Code:
QString fileName = QFileDialog::getSaveFileName(this, tr("Zapisz plik"),numer_fakt+".epp",tr("Pliki wymiany danych (*.epp)")); if(fileName.size()==0) return; return; out.setCodec(codec); out << encodedString; file.close();To copy to clipboard, switch view to plain text mode
what's next? in file I've got only ? ? ? ? sings :/
Last edited by TomASS; 9th February 2010 at 23:34.
Change line 14 with
or replace lines 12-14 with
Qt Code:
file.write(encodedString();To copy to clipboard, switch view to plain text mode
Line 8 is tricky. You'd better specify the encoding it comes from:
Qt Code:
To copy to clipboard, switch view to plain text mode
If the source file is utf-8 encoded of course.
Horse sense is the thing that keeps horses from betting on people. --W.C. Fields
Ask Smart Questions
Bookmarks