Display error(encoding)
조회 수: 34 (최근 30일)
이전 댓글 표시
Hello community!
recently, I met a problem. When I open my matlab files, the chinese character became "?????", by using script feature('locale') and I think related problem is :
ctype: 'en_US.windows-1252'
collate: 'en_US.windows-1252'
time: 'en_US.windows-1252'
numeric: 'en_US_POSIX.windows-1252'
monetary: 'en_US.windows-1252'
messages: 'en_US.windows-1252'
encoding: 'windows-1252'
terminalEncoding: 'GBK'
jvmEncoding: 'Cp1252'
status: 'MathWorks locale management system initialized.'
warning: 'System locale setting, zh_CN, is different from user locale setting, en_US.'
Clearly, something went wrong. How can I fix this in matlab?
댓글 수: 0
채택된 답변
Hassaan
2023년 12월 30일
편집: Hassaan
2023년 12월 30일
Way 1- Change MATLAB's Locale Settings to Chinese: You need to change MATLAB's locale settings to one that supports Chinese characters, like GBK or UTF-8. This can be done by setting the locale to zh_CN (for Simplified Chinese) or zh_TW (for Traditional Chinese). You can set the locale in MATLAB using the command:
feature('DefaultCharacterSet', 'UTF-8');
After running this command, restart MATLAB and see if the issue is resolved.
Way 2- Set the System Locale to Match MATLAB's: If the MATLAB fix alone doesn't work, you may also need to adjust your system's locale settings to match MATLAB's. This involves changing the system locale to Chinese through the Control Panel in Windows. After changing the system locale, you may need to restart your computer.
Way 3- Use Unicode-Encoded Files: When saving files that contain Chinese characters, make sure to save them with Unicode encoding (such as UTF-8). When you open a file in MATLAB, specify the encoding if necessary. For example:
fid = fopen('filename.txt', 'r', 'n', 'UTF-8');
Way 4- Check Your Fonts: Ensure that the font you're using in MATLAB supports Chinese characters. You can change the font from the MATLAB preferences.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
댓글 수: 3
Hassaan
2024년 1월 2일
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
- Technical Services and Consulting
- Embedded Systems
- Electrical and Electronics Engineering
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
