PDA

View Full Version : Polish characters in editor



mirek_zaklosa
7th June 2019, 07:44
Hello,

I'm trying to put some text to QMessageBox:

QMessageBox::warning(this,"B??d","Prosz? wybra? lub wpisa? numer");

after compiling i've got:
13148

anda_skoa
7th June 2019, 08:35
Is your source string correctly encoded in UTF-8?

Check that you are not using a local encoding, like latin2 or some weird Windows codec.

Cheers,
_

mirek_zaklosa
7th June 2019, 09:13
I've checked it before I wrote.

I've UTF-8 in editor settings in QT Creator:
13149

In editor there is correctly:
13150

I've checked encoding by Notepad++:
13151


I now I compiled and....still is wrong :(
13152

anda_skoa
8th June 2019, 09:23
Hmm, strange.

Can you try


const QString message = QString::fromUtf8(.....);
qDebug() << message;
QMessageBox::warning(this, message);

i.e. explicitly convert from UTF-8 and also writing it to the application output?

Cheers,
_

ChristianEhrlicher
8th June 2019, 18:59
As always - the best way is to not anything else than ascii for strings in the source code and do a proper translation with linguist.

ChrisW67
10th June 2019, 12:58
Regardless of what is in your source code, it seems that it is being inserted into the compiled binary encoded as Windows-1250 (https://en.wikipedia.org/wiki/Windows-1250) that is subsequently being interpreted as Windows-1252:


// What should be there
B &lstrok; &aogon; d &cacute;
U+0042 U+0142 U+0105 U+0064 U+0107
0x42 0xC5 0x82 0xC4 0x85 0x64 0xC3 0xA6 encoded with UTF-8

// What seems to be there in the binary
0x42 0xB3 0xB9 0x64 0xE6 encoded with Windows-1250
B ³ ¹ d æ if interpreted as Windows 1252