Character coding in titles


#1

Since I’m Hungarian and I implement apps containing text in my language, I have to use non-English characters. I have trouble at two places so far:

  • in the constructor of MainAppWindow I have to give the title name of the app as the first parameter of DocumentWindow() - if I write eg. “Ajánlólevél” (just a word with our characters) it shows unreadable characters instead of the given text
  • second parameter of the AlertWindow causes the same effect, I can’t create a proper popup window because the title of it won’t appear properly

In some cases using the T("") function solved this problem (I’m getting used to use it), unfortunately not for the title parameters (I mean you can use it there as well, but it won’t affect the printed result).
I read somewhere on the forum, when we have such problems, we should change the font of the text, but I can’t do it with these since they don’t have any setFont() function. Is there a way to fix it, or should I use other words without those letters? (I would prefer to fix it, though :slight_smile: )

Oh I forgot to mention, this problem occurs in Linux.


#2

Before you start worrying about fonts, have you checked that the compiler’s parsing your cpp file correctly? If you’ve saved a utf8 file and the compiler thinks it’s ascii, then that’d certainly mess things up.


#3

From http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html

[quote]-fexec-charset=charset
Set the execution character set, used for string and character constants. The default is UTF-8. charset can be any encoding supported by the system’s iconv library routine. [/quote]

The charset of my file is UTF-8, and the default charset of gcc is also UTF-8. I tried to convert it to some other charsets but I didn’t reach my goal.


#4

Ok, well if you’re definitely getting the right unicode into the program, and it’s not being rendered properly, that means that those characters are missing from the font you’re using… You could check in your distro to find a font that definitely has a full unicode set and try that instead.


#5