Enabling Japanese multibyte character support
Technical Note 200507
Arkitekturer:
All
Komponent:
compiler
Uppdaterad:
2020-05-27 16:20
Introduction
This technical note describes the appropriate project options to use when using Japanese characters in source code comments.
Discussion
In an environment that does not support multibyte characters, the second byte of Japanese Shift JIS encoded characters may be recognized as an escape character depending on the character code. This can cause unexpected results and compilation errors.
For example, if the second byte of the character code is 0x5C ( “ソ”, ”十”, “能”, etc.) at the end of the line, the line feed code becomes invalid. If this happens on a line that is a single-line comment, it causes the next line to be mistakenly interpreted as a continuation of the comment.
To correctly interpret Japanese characters, make the following changes to the project options. The settings are different depending on the version number of IAR Embedded Workbench shared components. To find the version number, see Help>About>Product Info.
Shared Components Version 8.x.x or greater
This applies IAR Embedded Workbench released in 2017 and later.
In the Project Options>C/C++ Compiler>Encodings tab, select System locale for these settings:
- Default source file encoding
- Default input file encoding
- Text output file encoding
Other Versions
This applies IAR Embedded Workbench released before 2017.
In the Project Options>C/C++ Compiler>Language 2 tab, select Enable multibyte support.
Conclusion
If source code files contain Japanese characters, you need to select the appropriate settings in the project options.
All product names are trademarks or registered trademarks of their respective owners.