how to set the encoding of MATLAB m-files to be UTF8
62 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to insert an m-file into LaTeX, and there are Chinese characters in my m-files, so I need the encoding of m-files to be UTF8.I have searched for some materials on the web, and I found the MATLAB command: slCharacterEncoding. So, I closed all the m-files and input the" slCharacterEncoding('UTF-8') "in the command window. But when I opened the m-file using Notepad++, the encoding with Chinese characters still is GB2312, and the m-files without Chinese characters is normal (UTF8).
how should I do to set the matlab editor to be UTF8 encoding? thanks
0 Kommentare
Antworten (2)
Image Analyst
am 27 Sep. 2019
Maybe open the file for reading, then open a file for writing using fopen(filename, , wt, 'UTF-8') (not sure if there is a parameter name that goes before UTF-8 so check the documentation. Then read from one file and write to the output file.
MathWorks Support Team
am 19 Feb. 2021
Bearbeitet: MathWorks Support Team
am 19 Feb. 2021
As of R2020a, the MATLAB Editor will default to saving new files using UTF-8. When opening existing files, the Editor and other functions like type or fopen automatically determine the current encoding. One can explicitly specify that the file should be saved using UTF-8 using the Save As dialog.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Filename Construction finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

