MATLAB COMPILER RELEASE NOTES User's Guide Page 246

  • Download
  • Add to my manuals
  • Print
  • Page
    / 716
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 245
R2011b
8-4
file, you may have to use a different encoding scheme. UTF-8 is often used to handle
multilingual characters. In R2011b, to handle multilingual characters, you can change
the default encoding scheme to UTF-8 by switching the MathWorks locale database.
Note that changing the default encoding scheme might cause characters other than 7-bit
ASCII characters in existing text files to be garbled.
See How the MATLAB Process Uses Locale Settings for more information.
How to Change MATLAB's Default Encoding to UTF-8
You can change the default encoding scheme on Mac OS X platforms by using the UTF-8
locale database found in the matlabroot/bin folder. If you have text files containing
characters other than 7-bit ASCII characters, you must convert the encoding before
changing the default encoding. For instructions, see “How to Convert Text File Encoding
to UTF-8” on page 8-4.
To change the default locale database, type:
mldir = fullfile(matlabroot,'bin');
copyfile(fullfile(mldir,'lcdata.xml'),...
fullfile(mldir,'lcdata_default.xml'));
copyfile(fullfile(mldir,'lcdata_utf8.xml'),...
fullfile(mldir,'lcdata.xml'));
How to Convert Text File Encoding to UTF-8
Before converting a file, copy the file to a new directory.
Use the Mac OS X TextEdit application to convert the file encoding. For example:
1
Open a MATLAB text file with TextEdit.
2
Select File ->Save as...
3
Change the file name.
4
Change Plain Text Encoding: to Unicode (UTF-8).
5
Save the file.
Alternatively, the following MATLAB code creates a new text file with the encoding set to
UTF-8:
function convertencoding(infile, outfile)
fpIn = fopen(infile, 'r', 'n');
Page view 245
1 2 ... 241 242 243 244 245 246 247 248 249 250 251 ... 715 716

Comments to this Manuals

No comments