Matlab读取UTF-8编码的中文字符

原创 2018年04月17日 21:25:01

在workspace中输入一下指令代码:

currentCharacterEncoding = slCharacterEncoding()

slCharacterEncoding(encoding) %encoding 为设置的具体的编码模式


这两句代码分别为:

1、读取当前编码模式

2、设置所需编码模式

Description

This command allows you to change the current MATLAB® character set encoding to be compatible with the character encoding of a model that you want to open.

currentCharacterEncoding = slCharacterEncoding()   returns the current MATLAB character set encoding.

slCharacterEncoding(encoding)        changes the MATLAB character set encoding to the specified encoding. You should only specify these values:

  • 'US-ASCII'
  • 'Windows-1252'
  • 'ISO-8859-1'
  • 'Shift_JIS'
  • 'UTF-8'

If you want to use a different character encoding, you need to start MATLAB with the appropriate locale settings for your operating system. Consult your operating system manual to change the locale setting. Simulink® can support any character encoding that uses single-byte or double-byte characters.

If you open a model that uses a particular character set encoding in a MATLAB session that uses a different encoding, a warning appears. For example, suppose that you create a model in a MATLAB session configured for Shift_JIS and open it in a session configured for US_ASCII. The warning message shows the encoding of the current session and the encoding used to create the model. If you encounter any problems with corrupted characters, for example when using MATLAB files associated with the model, then try using the slCharacterEncoding function to change the character encoding

  1. Close all open models.
  2. Use slCharacterEncoding to change the character encoding of the current MATLAB session to match the model character encoding.
  3. Reopen the model.

Note You must close all open models or libraries before changing the MATLAB character set encoding except when changing from 'US-ASCII' to another encoding.

来自 <Change MATLAB character set encoding>


python读取中文字符编码问题

preface:许久没遇到过编码问题,一没注意就被绊倒脚了。。 一、编辑器是以ASICC编码格式的,若想在程序中有中文,需要改为utf-8格式,加入如下代码可破: import sys reloa...
  • u010454729
  • u010454729
  • 2015-06-02 09:33:07
  • 1101

utf-8编码的中文字符在source in sight下的解决方法

  • 2011年08月30日 14:01
  • 192KB
  • 下载

UTF-8和中文字符编码(GB2312、GBK、GIB5、GB18030)的识别

1、编码方式介绍 了解一种字符集编码主要是要了解该编码的编码范围,编码对应的字符集(都包含哪些字符),和其他字符集编码之间的关系等。 ASCII ASCII码是7位编码,编码范围是0...
  • u013093948
  • u013093948
  • 2016-01-18 11:34:08
  • 2893

Python对中文字符的处理(utf-8/ gbk/ unicode)

现在在做分词的时候会处理大量有关中文字符的处理,经常输出乱码,老大让我暂时不考虑字符编码,但是为了看着爽不得不研究一下。 分词系统:NLPIR 因为不同的编译环境默认的汉字编码可能不一样,我的...
  • chixujohnny
  • chixujohnny
  • 2016-06-29 15:02:09
  • 36860

python_arcpy的中文编码略解

python的中文内部编码为unicode,而w'i
  • mgicshen
  • mgicshen
  • 2014-04-17 14:17:00
  • 1463

Qt中关于中文字符编码问题

今天在QtCreator中code的时候,遇到了一个奇怪的问题。我写了以下一段代码: QString filePath; filePath = QFileDialog::getOpenFile...
  • SZ_Silence06
  • SZ_Silence06
  • 2016-04-13 20:13:13
  • 1755

常用汉字的UTF-8编码及编码范围

在防止恶意注册中,输入随即图片认证时可以用下面的常用字符集:(请使用IE浏览器打开) \u7684\u4e00\u4e86\u662f\u6211\u4e0d\u5728\u4eba\u4eec\u...
  • god_7z1
  • god_7z1
  • 2014-10-23 15:31:55
  • 2424

fprintf字符编码

fprintf是ANSI的,UNICODE的,要用fwprintf;也可以用_ftprintf来同时兼容ANSI和UNICODE; 只写入了0和1,是因为UNICODE的123456789,...
  • yukin_xue
  • yukin_xue
  • 2013-10-10 12:52:33
  • 2148

JAVA中文编码和中文字符长度问题和解决方案

from: http://115.47.70.85/RuanJianGongCheng/2011-04/2859.htm REF:http://www.ibm.com/developerwork...
  • u012506661
  • u012506661
  • 2016-10-07 22:49:02
  • 3607

python 利用utf-8编码判断中文英文字符

python 利用utf-8编码判断中文英文字符
  • vitaminc4
  • vitaminc4
  • 2017-12-22 16:53:44
  • 655
收藏助手
不良信息举报
您举报文章:Matlab读取UTF-8编码的中文字符
举报原因:
原因补充:

(最多只允许输入30个字)