changeset 27564:8edca821f170

Add basic support for string encoding with fgetl and fgets (bug #55452). * oct-stream.cc (base_stream::do_gets): Convert from input encoding to UTF-8.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 25 Oct 2019 17:38:08 +0200
parents 3490ea06aba1
children 74173f04d2a3
files libinterp/corefcn/oct-stream.cc
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/oct-stream.cc	Fri Oct 25 01:42:56 2019 -0400
+++ b/libinterp/corefcn/oct-stream.cc	Fri Oct 25 17:38:08 2019 +0200
@@ -4104,7 +4104,11 @@
           }
 
         if (is.good () || (is.eof () && char_count > 0))
-          retval = buf.str ();
+          {
+            retval = buf.str ();
+            if (encoding ().compare ("utf-8"))
+              retval = string::u8_from_encoding (who, retval, encoding ());
+          }
         else
           {
             err = true;