Ubuntu下Matlab代码中中文注释乱码解决方案

环境:Ubuntu18.04,Matlab R2017b。

把matlab文件从windows拷贝到Ubuntu中,打开发现原先的中文注释全部乱码。真正原因是因为windows中.m文件采用的是gbk编码,Ubuntu中使用的是UTF-8编码,所以要把文件转为UTF-8编码。

详细解决步骤如下:

Step1:首先安装enca:sudo apt-get install enca

Step2:cd到m文件所在的文件夹。cd [path]

Step3:将所有m文件转为UTF-8:enca -x utf-8 *

 

再打开m文件,乱码问题已解决。

参考文献:

1.https://blog.csdn.net/kouyi5627/article/details/81513329

猜你喜欢

转载自www.cnblogs.com/happystudyeveryday/p/10324903.html
今日推荐