Why won't the editor display Chinese characters?

I can't figure out how to get the editor to display Japanese characters. If I enter the following in the command prompt:
'yyyy年 MM月 dd日'
The interpreted value returns as:
ans =
yyyy MM dd
The Chinese characters are ignored. This seems like unusual behavior to me. Even worse, if I save the text string in a file and re-open it, the Chinese characters are replaced by '?' marks. Is there a work-around for this?

댓글 수: 1

Try the following solution: https://uk.mathworks.com/matlabcentral/answers/280988-how-do-i-get-my-matlab-editor-to-read-utf-8-characters-utf-8-characters-in-blank-squares-in-editors

댓글을 달려면 로그인하십시오.

답변 (4개)

zahid jamal
zahid jamal 2019년 11월 28일

3 개 추천

i just found other solution for that, you need open your code open with notpad++ and it will show you all other language comments
NOTE; i will not work with simple notepad ,,, so you need Notepad++
捕获.PNG

댓글 수: 2

Respect bro, this info was really useful
sorry i did not understand?

댓글을 달려면 로그인하십시오.

Walter Roberson
Walter Roberson 2016년 8월 29일
편집: Walter Roberson 2016년 8월 30일

0 개 추천

댓글 수: 3

I appreciate the help, but it seems like they other posters hit a dead end too. I tried changing my lcdata.xml file as below, but the changes aren't being recognized by Matlab on a restart.
<locale name="en_US" encoding="UTF-8" xpg_name="en_US.UTF-8">
<!--<locale name="en_US" encoding="ISO-8859-1" xpg_name="en_US.ISO8859-1">-->
<alias name="en"/>
<alias name="en-US"/>
</locale>
Seems weird, right?
>> feature('locale')
ans =
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: 'IBM437'
jvmEncoding: 'windows-1252'
status: 'MathWorks locale managem...'
warning: ''
Which MATLAB version are you using?
I'm on 8.3.0.532 (R2014a).

댓글을 달려면 로그인하십시오.

Gerald
Gerald 2016년 9월 28일

0 개 추천

"Those Chinese comments in a M-file became strange symbols after re-open in Matlab Editor (even anyelse editors). The problem lies in the setting of "Standards and formats" setting of "Regional and Language Options". Set it to "Chinese (PRC)" and then the problem solved. Thus, it seems that Matlab read location information from this section and determine the lunguage with which it displays and stores contents."

댓글 수: 1

I'm not Chinese and I'm afraid that setting my locale to 'China (PRC)' will have all sorts of unintended (and undesired) consequences. How do I set a 'locale' that uses UTF-8 in U.S. English?

댓글을 달려면 로그인하십시오.

Kin Sung Chan
Kin Sung Chan 2022년 12월 13일

0 개 추천

Well, I use VSCode to open the Matlab .m file, and resave with GBK encoding. (bottom right button of the VSCode interface next to Spaces) (Well, I try with different types of encoding, and only this one works)
After that, Matlab can display the Chinese characters with no issues.

댓글 수: 2

well, I tried this method. Not working for me. Every time I reopen the file, the enconding format changed backed into UTF-8.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

질문:

2016년 8월 29일

댓글:

2023년 5월 17일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by