CodePudding user response:
Always remember to save trouble, don't in the code used in Chinese if you determine the TXT is try to impose on textstream set encoding utf8 words?CodePudding user response:
Use the tr, inside and don't use Chinese... Try to use Chinese QString: : fromLocal8Bit (" Chinese English "); Or a QString: : fromUtf8 (in readAll ());CodePudding user response:
Read more QT coding issues and look more like thatCodePudding user response:
File read, if can confirm file encoding can specify the codecCodePudding user response:
In the main () to add the following line of code: QTextCodec: : setCodecForTr (QTextCodec: : codecForLocale ());CodePudding user response:
Void UiUtil: : enableUtf8 () {QTextCodec * codec=QTextCodec: : codecForName (" UTF8 "); If (codec) {QTextCodec: : setCodecForTr (codec); QTextCodec: : setCodecForLocale (codec); QTextCodec: : setCodecForCStrings (codec); }}CodePudding user response:
Main function used in the above code, let Qt application by default use utf-8 display character, "to save trouble don't use Chinese in your code", do not take with it, ha haCodePudding user response:
References to the seventh floor jorneyr 10:53 published in 2011-11-21, the main function is used in the above code, let Qt application by default use utf-8 display character, "want to save trouble, don't use Chinese in your code", do not take with it, ha ha ha ha, whether you agree or not agree, the 5 and 6 floor setCodecForXXX usage there are a variety of problems!! Also use error (or work only in certain circumstances)CodePudding user response:
CSDN urine sex really poor, copy to come over from other web site's content, I found the original website, also delete my post, say my hair advertisement? Advertise your younger sister ah,