PDA

View Full Version : don't understand Qt's setCodecForCStrings



ber_44
9th July 2007, 01:56
QApplication app(argc, argv);
QTextCodec::setCodecForCStrings(QTextCodec::codecF orName("windows-1252"));
QTextCodec::setCodecForLocale(QTextCodec::codecFor Name("windows-1252"));

//...

Using this code I can display and 'e' with acute by calling


QMessageBox::about (this,"About",QString::fromLocal8Bit("\xe9"));

but "\xe1" for an 'a' with acute won't work.
On Windows, I get a compiler warning, saying that "hex escape sequence out of range".
Any workarounds?

ber_44
9th July 2007, 02:19
Sorry, this was a simple problem. I had a non-hex letter after e acute, and a hex letter after a acute, like "\xe1bbbbbb". The solution: "\xe1" "bbbbbb"