diff libinterp/corefcn/oct-stream.cc @ 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 3fec8e9fa2aa
children 8600f5ea1ec1
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;