> -----Original Message----- > From: development-bounces+kai.koehne=digia....@qt-project.org > [mailto:development-bounces+kai.koehne=digia....@qt-project.org] On > Behalf Of Thomas PABST > Sent: Monday, April 29, 2013 1:50 PM > To: development@qt-project.org > Subject: [Development] Charset probleme > > Hi, > > Usually, for charsset problems we can use theses functions: > > Qt Code: > > > > QTextCodec <http://qt-project.org/doc/qt-4.8/qtextcodec.html> > ::setCodecForTr(QTextCodec <http://qt-project.org/doc/qt- > 4.8/qtextcodec.html> ::codecForName("UTF-8")); > QTextCodec <http://qt-project.org/doc/qt-4.8/qtextcodec.html> > ::setCodecForLocale(QTextCodec <http://qt-project.org/doc/qt- > 4.8/qtextcodec.html> ::codecForName("UTF-8")); > QTextCodec <http://qt-project.org/doc/qt-4.8/qtextcodec.html> > ::setCodecForCStrings(QTextCodec <http://qt-project.org/doc/qt- > 4.8/qtextcodec.html> ::codecForName("UTF-8"));
Actually that method is gone in Qt 5. For the reasoning, read e.g. http://www.macieira.org/blog/2012/05/source-code-must-be-utf-8-and-qstring-wants-it/ You seem to just switch from Qt 3 to Qt 4, but I think the argument still is sound: Just expect source code to be UTF-8 these days. (Well, actually Qt 4 will have 'Latin1' by default, but for your specific example that'll work too.) > However, In my case for a porting Qt3 to Qt4 I have a global constant. > > Qt Code: > > > > > const QString <http://qt-project.org/doc/qt-4.8/qstring.html> > myVar = "text with accent é à è" > > > In this case the string is interpreted by gcc. Is there any QT DEFINE to force > use of UTF-8 ? According to http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html you can specify -finput-charset=UTF-8 in your QMAKE_CXX_FLAGS. Regards Kai _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development