changeset 26647:903c9a39e051 stable

Make sure octave-svgconvert encodes SVG documents in UTF8 (bug #55612) * octave-svgconvert.cc (main): Explicitely close original SVG file. Make sure the output stream is encoded in UTF8.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Thu, 31 Jan 2019 11:19:34 +0100
parents 46fa64c0ae40
children a569b5391347 c3c657ba1e97
files src/octave-svgconvert.cc
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/octave-svgconvert.cc	Wed Jan 30 16:30:24 2019 -0800
+++ b/src/octave-svgconvert.cc	Thu Jan 31 11:19:34 2019 +0100
@@ -765,6 +765,8 @@
       file.close();
       return -1;
     }
+  
+  file.close ();
 
   // Format
   if (strcmp (argv[2], "pdf") != 0 && strcmp (argv[2], "svg") != 0)
@@ -837,7 +839,8 @@
     {
       // Return modified svg document
       QTextStream out (&fout);
-      out << document.toString ();
+      out.setCodec ("UTF-8");
+      out << document.toByteArray ();
     }
 
   // Delete output file before writing with new data