The method "writeSBMLToString(SBMLDocument, String, String)" does not do the encoding right, when the standard charset on the computer is not UTF-8 (e.g. on Windows).
SBMLDocument doc = new SBMLDocument(3, 1);
Model model = doc.createModel("test_model");
History hist = model.getHistory();
Creator creator = new Creator("C°", "C°", "C°", "My@EMail.com");
hist.addCreator(creator);
// Right
ByteArrayOutputStream stream = new ByteArrayOutputStream();
new SBMLWriter().write(doc, stream, null, null);
System.out.println(stream.toString("UTF-8"));
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Example:
SBMLDocument doc = new SBMLDocument(3, 1);
Model model = doc.createModel("test_model");
History hist = model.getHistory();
Creator creator = new Creator("C°", "C°", "C°", "My@EMail.com");
hist.addCreator(creator);
// Wrong
System.out.println(new SBMLWriter().writeSBMLToString(doc, null, null));
System.out.println();
// Right
ByteArrayOutputStream stream = new ByteArrayOutputStream();
new SBMLWriter().write(doc, stream, null, null);
System.out.println(stream.toString("UTF-8"));
Thanks, I will have a look and do some testings on the read and write methods when the default encoding is not UTF-8.
This was fixed some time ago, thanks for the report.