On Thu, 29 Apr 1999, you wrote: >On Thu, Apr 29, 1999 at 12:58:05PM +0200, Warwick Allison wrote: >: >: The setDefaultCodec() should not be needed - the codec should do all you need, >: and only when you need it. The codec to use in a codec->toUnicode() is the >: QTextCodec::codecForLocale(), or better, use the encoding named in the .mo file >: to choose a codec. > >Ok! I got it. but I don't understand last sentance "use the ... a codec". Standard .po files declare the encoding in which they are written. I presume this information is somehow available in the .mo file too. THIS is the encoding that should be used to choose a codec to convert such text to Unicode. In pseudocode: KLocale::loadMOFile() { ... const char* charset = mo_file.encodingName(); this->i18n_codec = QTextCodec::codecForName(charset); if ( !codec ) fatal("No codec for %s", charset); ... } QString KLocale::translate(const char* txt) { const char* translation = ... lookup txt; if ( !translation ) return QString(txt); // Latin1 return i18n_codec->toUnicode(translation); } Of course, Qt's builtin QTranslator stuff works with Unicode form the start (the translation files are stored in Unicode), but above we stick to KDE's existing techniques - they can be modified later if the need arises. -- Warwick