PDA

View Full Version : Wrong charsset foc const QString



thomas1818
29th April 2013, 10:09
Hi,

Usually, for charsset problems we can use theses functions:


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

However, In my case for a porting Qt3 to Qt4 I have a global constant.

const QString myVar = "text with accent é à è"

In this case the string is interpreted by gcc. Is there any QT DEFINE to force use of UTF-8 ?

Thanks

Rhayader
30th April 2013, 12:07
try this
const QString myVar (QObject::trUtf8("text with accent é à è"));