PDA

View Full Version : QString Special Character Problem



hakiim35
3rd October 2011, 13:07
Hi,
I have a problem with Turskish special characters, especially 'ı' (not 'i') in QStrings.
The exact problem is that, I must handle upper-to-lower/lower-to-upper conversions for any strings which may even include those special characters. For an example, I'd like to convert the word "Image" into "ımage", not to "image" etc.
Any help welcome.

saimel
3rd October 2011, 15:38
Try to do this in your main loop:


#include <QTextCodec>

int main(int argc, char *argv[])
{

QTextCodec::setCodecForTr(QTextCodec::codecForName ("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecF orName("UTF-8"));
QTextCodec::setCodecForLocale(QTextCodec::codecFor Name("UTF-8"));

QApplication a(argc, argv);
Agenda w;
w.show();

return a.exec();
}

I did it for some especial spanish characters and it work out, maybe in your case the locale to use is not UTF-8, so you should try with another locale, but I think that it could be the solution, so you try and let us know if it work.