Solution to MATLAB Chinese garbled characters in English operating systemChinese characters in the MATLAB editor under English operating environment will be displayed as garbled characters.¶
ReasonFollow the online tutorials to change the system environment configuration```¶
Control Panel,Region,Administrative,Language for non-Unicode Option Set as Chinese(Simplified,China)
Control Panel,Region,Formats,Format Option Set as Chinese(Simplified,China).
After this setting, the system format changes to Chinese, and the matlab display language also changes to Chinese. However, when plotting, garbled characters will still be displayed.
The main reason is character set mismatch.
## MethodFind the lcdata.xml file in the MATLAB directory. When the file is empty, MATLAB automatically calls the system default character set. Therefore, copy lcdata_utf8.xml in the MATLAB directory and rename it to lcdata.xml. Replace the content with the following```
<?xml version="1.0" encoding="UTF-8" ?>
<!-- MathWorks Locale Database -->
<!-- File Name: lcdata_utf8.xml -->
<!-- Copyright 2007-2016 The MathWorks, Inc. -->
<lcdata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="lcdata.xsd">
<!-- Codeset entry -->
<codeset>
<encoding name="UTF-8">
<encoding_alias name="utf8"/>
<encoding_alias name="EUC-CN"/>
<encoding_alias name="euccn"/>
<encoding_alias name="1252"/>
<encoding_alias name="ISO8859-15"/>
<encoding_alias name="ISO885915"/>
<encoding_alias name="ISO8859-14"/>
<encoding_alias name="ISO885914"/>
<encoding_alias name="ISO8859-1"/>
<encoding_alias name="ISO88591"/>
<encoding_alias name="936"/>
</encoding>
</codeset>
<!-- Locale entries -->
<locale name="en_US" encoding="UTF-8" xpg_name="en_US.UTF-8">
<alias name="en"/>
</locale>
<locale name="zh_CN" encoding="UTF-8" xpg_name="zh_CN.UTF-8">
<alias name="zh-Hans"/>
<alias name="zh-Hans-CN"/>
</locale>
</lcdata>