Qt-interest Archive, August 2006
unable to have greek characters appear in a text Label
Message 1 in thread
Hello everyone,
the title is self explanatory but only up to a point.
What really happens is:
when i input some greek text on the 'text' field of my text label then
it appears absolutely fine on the label. I note this, so that you know
there are times (ie during design) when greek characters appear fine..
however i have implemented a small virtual alphanumeric keypad (much
like the keypads on the mobile phones). I want, with the aid of a
button to switch between english and greek. but when running it and i
switch to greek characters they do not appear on the label. instead i
get ????? (question marks)
any ideas?
nass
--
[ signature omitted ]
Message 2 in thread
Hi,
> however i have implemented a small virtual alphanumeric keypad (much
> like the keypads on the mobile phones). I want, with the aid of a
> button to switch between english and greek. but when running it and i
> switch to greek characters they do not appear on the label. instead i
> get ????? (question marks)
> any ideas?
Sure, what's the difference between the first case, where characters are
input from the keyboard, and the second case? How do you specify the
characters that are to be displayed on the button?
If you write in your source code:
const char *omega = "Ï";
QString s(omege);
there are many issues:
* the editor may save your source file as UTF-8, UTF-16, ISO 8859-7 or
any other encoding,
* the compiler may interpret the source file differently,
* the QString constructor may interpret non-ASCII characters differently
again, as explained in the QObject::trUtf8() documentation:
http://doc.trolltech.com/4.1/qobject.html#trUtf8
I suggest using the UTF-8 encoding in your source code:
const char omega = "\0317\0211";
QString s(omega);
instead of:
const char omega = "Ï";
QString s = QString::fromUtf8(omega);
--
[ signature omitted ]