MacOSX encoding problem

조회 수: 9 (최근 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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by