Garbled characters of gcc in Japanese Shift-JIS Encoding

Source: Internet
Author: User

When developing C, C ++, Pro * C, and other programs on Linux or Unix systems, it is inevitable to use the gcc tool, A common Japanese Encoding System in Japanese is Shift-JIS encoding. However, when gcc is used for Shift-JIS encoding, some Chinese characters are garbled, why.

In Shift-JIS encoding, two bytes are used for Chinese characters. When the second byte is 0x5c, garbled characters will occur when gcc is used for compilation. Generally, the following Chinese characters are incorrect.

/X81/x5c ―
/X83/x5c release
/X84/x5c release
/X87/x5c IX
/X89/x5c restart
/X8a/x5c release
/X8b/x5c fraud
/X8c/x5c Gui
/X8d/x5c Structure
/X8e/x5c Silkworm
/X8f/x5c 10
/X90/x5c Application
/X91/x5c Zeng
/X92/x5c release
/X93/x5c restart
/X94/x5c
/X95/x5c table
/X96/x5c violence
/X97/x5c
/X98/x5c Lu
/X99/x5c rabbit
/X9a/x5c
/X9b/x5c release
/X9c/x5c release
/X9d/x5c get
/X9e/x5c release
/X9f/x5c release
/Xe0/x5c restart
/Xe1/x5c release
/Xe2/x5c Bing
/Xe3/x5c release
/Xe4/x5c hip
/Xe5/x5c release
/Xe6/x5c release
/Xe7/x5c release
/Xe8/x5c release
/Xe9/x5c release
/Xea/x5c release
/Xed/x5c restart
/Xee/x5c release

There are three solutions. The first one is the best. Change the encoding, for example, the Japanese EUC encoding or utf8 encoding are OK. The second method is to avoid using the above words, but it is a little difficult, because many of them are also commonly used Japanese characters. The third type is to use escape characters. For example, the word "Yes" is replaced by "/x94/x5c. Of course, another method is to directly add the Backslash "/".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.