12-27-2012 05:55 AM
Hi !
My project is set to use UTF-8 encoding in all its files. I have a Label defined in qml. When I set its text property from the QML file, I have no issue with charcters such as "è". But with the same text, hard-coded in C++, the chracter is miswritten.
Any ideas ?
Solved! Go to Solution.
12-27-2012 10:20 AM
Hello!
Please try
QString::fromUtf8("your text");
12-27-2012 03:14 PM
Unfortunately this is not working for DropDown, or I am doing something wrong.
12-27-2012 03:27 PM
The following works for me:
dropDown->add(Option::create()
.value(123)
.text(QString::fromUtf8("put UTF8 text here"))
.selected(YES));
12-28-2012 07:06 AM
Could you post a short example of what you're doing with DropDown along with the string you're trying to use?
01-03-2013 05:21 AM
Hey tonygluk and everyone else,
So basically my code is
ddSecond->add(Option::create().text(QString::fromUtf8("RME_Estado de México")));
And this is a result http://gyazo.com/1c544a96b29a9174b04962b3cf67bfe1
01-03-2013 06:00 AM
I'm a bit confused because I tried to use
QString::fromUtf8("RME_Estado de México")
as a title of my TitleBar and this works perfectly in my case.
My encoding settings (in Qt Creator):
Default encoding: UTF-8
UTF-8 BOM: Keep If Already Present
You could also try to substitute é with \u00e9, i.e.
QString::fromUtf8("RME_Estado de M\u00e9xico")
01-03-2013 06:23 AM
For title of TitleBar it works properly for me even without convertation fromUtf8.
This one
QString::fromUtf8("RME_Estado de M\u00e9xico")
Works well, thank you! But another problem is that I'm getting the data dinamicaly from a server. Is there an easy way to replace é with \u00e9?
01-03-2013 06:39 AM
01-03-2013 06:41 AM
Ah, my bad. I set the title directly in QML. Okay, will check encoding. Thanks a lot!