how to set the encoding of MATLAB m-files to be UTF8
323 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Image Analyst
el 27 de Sept. de 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
el 19 de Feb. de 2021
Editada: MathWorks Support Team
el 19 de Feb. de 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 comentarios
Ver también
Categorías
Más información sobre Text Files en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!