Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved]Swedish sp letters
toho71 last edited by
Could someone explain to me why my Swedish Letters (å,ä,ö) doesnt work in my QT application.
I have tried to change the encoding to Latin 1 as someone suggested but No.
It works fine when i put the letters as text on buttons etc in the designer mode but not when i try to change them in the code.
I work in Debian 6.0
New Ideas pls.
leon.anavi last edited by
Try with Unicode encoding.
morinehtar0 last edited by
When you put literal text in your code, it gets transferred to a QString using LAtin/standard ascii, I think.
But since your text probably contains utf8, it goes wrong.
To tell QString to read your text as utf8, you can do:
Hope this helps...
andre last edited by
"This":http://developer.qt.nokia.com/wiki/Strings_and_encodings_in_Qt is a work-in-progress wiki page on the topic, but there are also several forum discussions on this already.
Basically, there are two approaches, and opinions among developers differ in what the best and what the most workable way of doing it is.
use the idea outlined in the wiki page above, by explicitly using UTF-8 encoding for your source files, setting the codecs, right, and explicitly TR_UTF8 and the likes. Personally, I think this is too easy to break, but that is just me.
don't put the non-ASCII texts in the source code directly, but use Qt Linguist to translate your application. That way, there is nothing special to do in your code, except install the translation at startup. The translation file can be put in a resource and thus compiled in, if you want.
Personally, I keep my string literals in the source code in English, but you may just as well use any other language including Swedish, as long as you don't use non-ascii characters. Then, in Linguist, you create your Swedish, correctly spelled translation. I do that for English as well. Most strings don't need actual translation, but it is very useful for things like plurals ("one item found" vs. "3 items found").
toho71 last edited by
Thank you for your answers.
I think that this is a problem I have to solve with the Andre solution