MATLAB and character encoding: how to start / edit m ISO8859-1 file in UTF-8 system?

I have a great application written in Matlab with lines and comments using ISO8859-1. I would like to launch and update this application in the Matlab UTF-8 environment (Matlab 2012a for Linux). Is it possible? The editor shows small squares for all non-ASCII characters, and string comparison does not work.

He is my quick decision:

There seems to be no reliable way to deal with non-native encoding from Matlab itself. I assumed that the encoding change from the application did not work. Instead, I changed my language from the command line before starting Matlab. Sort of

export LC_CTYPE="en_US.ISO-8859-1"; matlab; 
+4
source share
1 answer

You can simply convert the file encoding with an external program. See https://askubuntu.com/questions/41643/how-to-convert-multiple-iso8859-1-to-utf-8 . The only problem is that you probably have to convert the encoding back if you want to run them in older versions of Windows Matlab.

If you do not want to convert the files, try also using the undocumented command function ('DefaultCharacterSet', 'ISO8859-1') at the Matlab prompt. I have never used it, so I don’t know if it will work for you, but it's worth a try.

+3
source

Source: https://habr.com/ru/post/1468968/


All Articles