Why won't the editor display Chinese characters?

57 ビュー (過去 30 日間)
Keith Hooks
Keith Hooks 2016 年 8 月 29 日
コメント済み: Zhibin Deng 2023 年 5 月 17 日
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 件のコメント
Oleg Komarov
Oleg Komarov 2016 年 12 月 26 日
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 日
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 件のコメント
Dan Mirea
Dan Mirea 2020 年 3 月 12 日
Respect bro, this info was really useful
zahid jamal
zahid jamal 2020 年 3 月 13 日
sorry i did not understand?

サインインしてコメントする。


Walter Roberson
Walter Roberson 2016 年 8 月 29 日
編集済み: Walter Roberson 2016 年 8 月 30 日
  3 件のコメント
Walter Roberson
Walter Roberson 2016 年 8 月 30 日
Which MATLAB version are you using?
Keith Hooks
Keith Hooks 2016 年 9 月 6 日
I'm on 8.3.0.532 (R2014a).

サインインしてコメントする。


Gerald
Gerald 2016 年 9 月 28 日
"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 件のコメント
Paul McKenzie
Paul McKenzie 2017 年 5 月 23 日
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 日
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 件のコメント
Kin Sung Chan
Kin Sung Chan 2022 年 12 月 13 日
Zhibin Deng
Zhibin Deng 2023 年 5 月 17 日
well, I tried this method. Not working for me. Every time I reopen the file, the enconding format changed backed into UTF-8.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by