Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Special characters in m-files do not carry over to published html

Asked by Dominique on 7 Jan 2013

I `publish()` quite a bit of m-files to html format for teaching purposes. I (and the students) like to write comments, titles, etc., in French with accentuated letters. I save my m-file with utf-8 encoding. Matlab's `publish` generates a html file with utf-8 character encoding as well but somewhere in the process, accentuated characters have been transformed to rubbish.

For example, the character "é" is transformed to a hard-coded "é" in the html output, which is displayed as "é".

Are there options somewhere to preserve accentuated characters in comments?

Thanks!

0 Comments

Dominique

Products

No products are associated with this question.

2 Answers

Answer by Dominique on 7 Jan 2013
Accepted answer

Thanks for the quick reply. I tried 4 variants of UTF-16 and they did not work (either causing Matlab to complain about unrecognized characters or ignoring entire chunks of the file.) On the other hand, other encodings such as Western ISO-8859-15 work. Mac Roman doesn't work (I'm using OSX.)

I guess we'll just have to make an exception for m-files and save them using ISO-8859-15.

Many thanks!

0 Comments

Dominique
Answer by Walter Roberson on 7 Jan 2013

It appears to be doing a byte-by-byte publication. é is the byte sequence that would be used to encode é in UTF-8

char(unicode2native('é','utf-8'))

As an experiment, could you try saving a copy of the .m file as UTF-16 and publish from that ?

0 Comments

Walter Roberson

Contact us