MacOSX encoding problem

3 ビュー (過去 30 日間)
Denis Zhegalin
Denis Zhegalin 2011 年 7 月 26 日
回答済み: MathWorks Support Team 2021 年 2 月 19 日
[EDIT: 20110626 09:40 CDT - reformat - WDR]
Hello everebody, I have an encoding trouble.
*>> ver*
-------------------------------------------------------------------------------------
MATLAB Version 7.12.0.635 (R2011a)
Operating System: Mac OS X Version: 10.7 Build: 11A511
Java VM Version: Java 1.6.0_26-b03-383-11A511 with Apple Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
mac console:
DeZhMBP:~ clock$ locale
LANG="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_CTYPE="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_ALL="ru_RU.UTF-8"
It seems to me that UTF8 is a correct encoding for my OS.
MATLAB console:
>> getenv('LANG')
ans =
ru_RU.KOI8-R
OK, trouble is here, I set up a startup.m in my start folder:
bdclose all;
set_param(0, 'CharacterEncoding', 'UTF-8');
slCharacterEncoding('UTF-8');
Restart MATLAB and again:
>> getenv('LANG')
ans =
ru_RU.KOI8-R
I try to set manually:
>> bdclose all;
set_param(0, 'CharacterEncoding', 'UTF-8');
>> getenv('LANG')
ans =
ru_RU.KOI8-R
I can write m-scripts using my native language. Its OK, but command window shows me: -0.0092942 3.0647 . .
I do not understand what should I do to improve it. I need UTF-8 for platform sharing. Any ideas?
Please help.
  4 件のコメント
Denis Zhegalin
Denis Zhegalin 2011 年 7 月 27 日
now I have a startup script:
bdclose all;
set_param(0, 'CharacterEncoding', 'UTF-8');
slCharacterEncoding('UTF-8');
feature('DefaultCharacterSet','UTF-8');
setenv('LANG','ru_RU.UTF-8');
But still have:
>> getenv('LANG')
ans =
ru_RU.UTF-8
>> disp привет
Denis Zhegalin
Denis Zhegalin 2011 年 7 月 27 日
I've added to startup.m all LC_XXXXXX variables connected with locale.
>> !locale
LANG="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_CTYPE="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_NUMERIC="C"
LC_TIME="ru_RU.UTF-8"
LC_ALL=
I've put the same into environment.plist, ~/.bashrc, ~/.profile and even launched.conf. And again have the same result. And I don't have troubles with other software with encoding.
Colleagues?

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

採用された回答

Denis Zhegalin
Denis Zhegalin 2011 年 8 月 9 日
The MathWorks locale database can be found at the following location and name.
$matlabroot/bin/lcdata.xml
Find the following entry.
<locale name="ru_RU" encoding="KOI8-R" xpg_name="ru_RU.KOI8-R">
<alias name="ru"/>
<alias name="ru_SU"/>
</locale>
Modify as the following.
<locale name="ru_RU" encoding="UTF-8" xpg_name="ru_RU.UTF-8">
<alias name="ru"/>
<alias name="ru_SU"/>
</locale>
That's it.

その他の回答 (1 件)

MathWorks Support Team
MathWorks Support Team 2021 年 2 月 19 日
This issue is fixed as of R2020a when MATLAB on Mac atarted using UTF-8 as the default encoding.

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by