Qt World Summit: Submit your Presentation

How to set UTF-8 encoding globally?

  • Dear Qt Forum,
    I'm developing an embedded system based on Linux Yocto and Qt 5.3. The default character encoding of the system is ISO-8859-1.

    Some Qt applications needs to deal with files encoded in UTF-8. I was wondering: is there a way to set the default character encoding to use? E.g. a system call to execute at application startup?

    Searching in internet I've found that the QTextCodec::setCodecForCStrings() has been removed. I've tried to use the QTextCodec::setCodecForLocale but is seems that the set is limited to the function scope.

    Which is the right way to tell to a QCoreApplication that the default character encoding is UTF-8 (instead of system default)?

    Thanks in advance for your time


Log in to reply