apommel / vscode-matlab-interactive-terminal

VS Code extension allowing for an interactive Matlab terminal and launching of scripts through Matlab Engine for Python
MIT License
46 stars 10 forks source link

can't show Chinese character #5

Closed ilcpm closed 4 years ago

ilcpm commented 4 years ago

when it runs

fprintf('123中文测试abc')

it should print

123中文测试abc

but it only print

123abc
apommel commented 4 years ago

This seems to be due to Matlab Python Engine handling of encoding, which depends on the system locale. However, it seems that R2020a uses UTF-8, if that's possible, could you test it with this release?

apommel commented 4 years ago

R2020a did not solve the issue on my side. However, my latest release should have solved the issue, as your example works on my side. Could you confirm that it works for you?

ilcpm commented 4 years ago

Thank you for your reply. the problem now is solved.

Starting Matlab...
>> fprintf('123中文测试abc\n')
123中文测试abc

>> 

system info: win10 1909, matlab 2019b, python 3.7 x64 location: China system language: Zh-CN, Chinese Simplified

the defalt code matlab use is GBK, so when i run a utf-8 file, the result with Chinese is wrong. but a GBK file is right.

So, all the problem is solved, I hope these info can help others

apommel commented 4 years ago

Yes it would be nice if Matlab would use UTF-8, it would not create as much problems. I consider it solved then.