Polish chars in the HTML generated by Qt.
Hi. Look at my code. I have a very big problem, namely the encoding of the HTML file. So, polish chars in QMessageBox works correctly, but in text of the "out" no so good.
Example:
Code:
out << "<h2>INFORMACJA O GOTOWOŚCI DZIECKA<br />DO PODJĘCIA NAUKI W SZKOLE PODSTAWOWEJ</h2>\n";
looks:
Quote:
INFORMACJA O GOTOWOÂŒCI DZIECKA
DO PODJÊCIA NAUKI W SZKOLE PODSTAWOWEJ
Ê =/= Ę :(
I coded the files in UTF-8 with BOM. Polish characters, which are get from the checboxe's label works correctly.
Re: Polish chars in the HTML generated by Qt.
AFAIK QTextStream uses its own codec. Have a look at QTextStream::setCodec().
Re: Polish chars in the HTML generated by Qt.
You can clearly? I have already tried to use this feature, but I do not know how to change the encoding on correct. UTF-8, Windows-1250 not working and all other attempt wail.
Re: Polish chars in the HTML generated by Qt.
What is the encoding of your source code file?
Re: Polish chars in the HTML generated by Qt.
Quote:
Originally Posted by
wysota
What is the encoding of your source code file?
"System" :o
Re: Polish chars in the HTML generated by Qt.
I'm not asking what QtCreator shows, I'm asking what the encoding is. There is no encoding called "System". Since you're using Windows it's probably UTF-8. See if wrapping your strings in QString::fromUtf8() helps.
Re: Polish chars in the HTML generated by Qt.
Quote:
Originally Posted by
wysota
I'm not asking what QtCreator shows, I'm asking what the encoding is. There is no encoding called "System". Since you're using Windows it's probably UTF-8. See if wrapping your strings in
QString::fromUtf8() helps.
Not working, but QString::fromAscii() works correctly. Thanks.
Re: Polish chars in the HTML generated by Qt.
Well, it shouldn't. Use fromUtf8() and remove your calls that set explicit codecs for C strings.
Re: Polish chars in the HTML generated by Qt.
Quote:
Originally Posted by
wysota
Since you're using Windows it's probably UTF-8. See if wrapping your strings in
QString::fromUtf8() helps.
I know for sure that in greek Windows Xp the system default is always Windows-1253. Can't tell for sure about polish but in a similar case the QString::fromLocal8bit is more suitable, Of course there is the option to change your sources encodings to UTF-8
Re: Polish chars in the HTML generated by Qt.
fromLocal8Bit() won't be any good because local encodings change and the source file encoding stays the same. So using local8Bit() will fail if the file gets compiled on say... Linux with Chinese locale but fromUtf8() will work because the file is still encoded in utf-8 regardless of the settings of the computer (and its OS) it is opened on.
Re: Polish chars in the HTML generated by Qt.
Maybe this is a compiler problem ?
We have all sources coded in 1250 and this works perfectly :