The main () function uses QTEXTCODEC::SETCODECFORTR (QTEXTCODEC:: Codecforname ("GBK")) //Note that this is still "GBK", not "UTF-8" Then convert all qcom\ files to Utf-8+bom encoding, note that if the file is converted to UTF-8 (no BOM), the compilation will still fail. The QT Creator environment is set up with the UTF-8 code first, Compile source file will error.Įrror message "Fatal error C1018: Unexpected #elif".Ĭonvert all qcom\ files to ANSI encoding using the tool, the main () function uses QTEXTCODEC::SETCODECFORTR (Qtextcodec::codecforname ("GBK")) ![]() The author of the Windows environment of the QT creator+ Microsoft vs Compiler, the environment is set with the ANSI (i.e. Source code qcom\mainwindow.cpp,aboutdialog.cpp files such as UTF-8 encoding (no BOM), but the Qcom\qextserial\*.* file is ANSI-encoded. Qcom Cross-platform serial debugging assistant () Here are only the most commonly used 3 compilers (Microsoft vs in the Cl,mingw in the G++,linux under the g++), the source code using GBK and no BOM UTF-8 and a BOM UTF-8 these 3 kinds of encoding to save, the phenomenon occurs as shown in the following table.Įrror C2001: There are line breaks in constants Qtextcodec *codec = Qtextcodec::codecforname ("UTF-8") //Situation 2 Qtextcodec *codec = Qtextcodec::codecforname ("GBK") //Situation 1 ![]() QT needs to specify the character encoding used in the main () function: UTF-8 with ANSI (that is, GBK), you can use the EditPlus tool "save file as" or the Encodersoft Encoding conversion tool to batch convert. Unicode (UTF-16) encoding means that all characters are represented in 2 bytes. The characters between 0x00~0x7f, which are still 1 bytes, represent 1 characters. ★ Under the Simplified Chinese Windows system, ANSI encoding represents GBK/GB2312 encoding, and ANSI typically uses a range of 0x80~0xff 2 bytes to represent 1 Chinese characters. ★GBK, GB2312, and UTF8 must be encoded in Unicode to convert from one to the other: GBK is an extension of GB2312, in addition to compatibility with GB2312, it can also display traditional Chinese, as well as Japanese kana. GBK contains all Chinese characters, is the country code, the generality is worse than the UTF8, but UTF8 occupies the database bigger than GBD. The text encoding of the GBK is expressed in double-byte notation, that is, both Chinese and English characters are represented by double-byte, in order to distinguish the language, the highest bit is set to 1. ★GBK is the standard of GB2312 compatible GB2312 on the basis of national standard. ![]() For example, if it is UTF8 code, it can display Chinese in the foreigner's English ie, they do not need to download IE's Chinese language support package. UTF-8 encoded text can be displayed on browsers that support the UTF8 character set in each country. UTF-8 contains the characters that all countries in the world need to use, and is an international code with strong versatility. is a multi-byte encoding used to solve the international character, which uses 8 bits (or one byte) in English, and Chinese uses 24 (three bytes) to encode. ![]() ★utf-8:unicode Transformationformat-8bit, which allows BOM, but usually does not include BOM. The two common codes for QT are: UTF-8 and GBK Files are garbled when they are uploaded from window to Ubuntu because the Ubuntu environment setting defaults to Utf-8,windows, which is GBK by default.įile encoding for the behavior, such as text editor, options, tools-Qt Creator, menu, Windows environmentĭefault encoding: System (Simplified Chinese Windows system by default refers to the GBK encoding, which is the dropdown box option in the gbk/windows-936-2000/cp936/ms936/windows-936)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |