Desktop Tools and Development Environment
7-7
fclose(fpOut);
end
To use this function, you need to know the current encoding, from_encoding.
• For MATLAB R2010b or later:
ret = feature('locale');
from_encoding = ret.encoding;
• For MATLAB R2008a through R2010a:
ret = feature('locale');
[t,r] = strtok(ret.ctype,'.');
from_encoding = r(2:end);
For example, a file, myFile.m, was created with MATLAB encoding set to ISO-8859-1.
To convert the file to UTF-8, type:
convert_file_encoding('myFile.m','myFileUTF8.m','ISO-8859-1','UTF-8')
Compatibility Considerations
In a future release, the UTF-8 version of the MathWorks locale database will be the
default on Mac OS X systems. Any text file created in MATLAB that is encoded in the
user default encoding and contains characters other than 7-bit ASCII characters must
be converted to the UTF-8 encoding scheme. Otherwise, MATLAB and other MathWorks
products might not be able to properly load the files.
You must convert the file encoding before changing the default locale database.
Do not convert text files to UTF-8 if you share them with users on Windows platforms.
Comments to this Manuals