Why won't the editor display Chinese characters?

65 views (last 30 days)
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 Comment
Oleg Komarov
Oleg Komarov on 26 Dec 2016
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

Sign in to comment.

Answers (4)

zahid jamal
zahid jamal on 28 Nov 2019
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

Walter Roberson
Walter Roberson on 29 Aug 2016
Edited: Walter Roberson on 30 Aug 2016
  3 Comments

Sign in to comment.


Gerald
Gerald on 28 Sep 2016
"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 Comment
Paul McKenzie
Paul McKenzie on 23 May 2017
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?

Sign in to comment.


Kin Sung Chan
Kin Sung Chan on 13 Dec 2022
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 Comments
Zhibin Deng
Zhibin Deng on 17 May 2023
well, I tried this method. Not working for me. Every time I reopen the file, the enconding format changed backed into UTF-8.

Sign in to comment.

Categories

Find more on Data Import and Export in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!