xC9 instead of É in xml file generated by Matlab

Viewed 69

I'm generating an xml file with Matlab by filling it according to an excel file.

xmlfile = fopen(file.xml, 'w');
fprintf(xmlfile, xmlString);

Where xmlString is a string which contains the all xml content. The problem is all É and é of my string are replace by xC9 and xE9 in the final xml file.

Is there a way to avoid that ?

(I put the '<?xml version="1.0" encoding="UTF-8"?>' at the start of the file of course)

Thanks for helping !

1 Answers

If Matlab allows you to say what the target character encoding should be, you may be able to override its default, which appears to be US-ASCII.

Failing that, you might want to add a post-processing step to replace the numeric character references with their literal equivalents. The simplest, assuming it preserves the information you need, is to use something like xmllint or rxp, which read XML and output a normalized form of the input.

Related