changeset 27150:961b76f59fa2

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Wed, 05 Jun 2019 13:04:24 +0000
parents 61226b7bd6b9 (current diff) 8a07083c8cfc (diff)
children a498fab46e03
files doc/interpreter/contributors.in libinterp/corefcn/ft-text-renderer.cc libinterp/corefcn/gl2ps-print.cc
diffstat 3 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/contributors.in	Tue Jun 04 20:04:21 2019 +0000
+++ b/doc/interpreter/contributors.in	Wed Jun 05 13:04:24 2019 +0000
@@ -374,6 +374,7 @@
 Quentin H. Spencer
 Christoph Spiel
 David Spies
+Imad-Eddine Srairi
 Andreas Stahel
 Richard Stallman
 Russell Standish
--- a/libinterp/corefcn/ft-text-renderer.cc	Tue Jun 04 20:04:21 2019 +0000
+++ b/libinterp/corefcn/ft-text-renderer.cc	Wed Jun 05 13:04:24 2019 +0000
@@ -914,6 +914,13 @@
             // Retrieve the length and the u32 representation of the current
             // character
             int mblen = octave_u8_strmbtouc_wrapper (&u32_c, c + icurr);
+            if (mblen < 1)
+              {
+                // This is not an UTF-8 character, use a replacement character
+                mblen = 1;
+                u32_c = 0xFFFD;
+              }
+                
             n -= mblen;
 
             if (m_do_strlist && mode == MODE_RENDER)
--- a/libinterp/corefcn/gl2ps-print.cc	Tue Jun 04 20:04:21 2019 +0000
+++ b/libinterp/corefcn/gl2ps-print.cc	Wed Jun 05 13:04:24 2019 +0000
@@ -929,9 +929,10 @@
               {
                 int mblen = octave_u8_strmblen_wrapper (c + i);
 
+                // Replace multibyte or non ascii characters by a question mark
                 if (mblen > 1)
                   {
-                    str += " ";
+                    str += "?";
                     if (! warned)
                       {
                         warning_with_id ("Octave:print:unsupported-multibyte",
@@ -941,6 +942,19 @@
                         warned = true;
                       }
                   }
+                else if (mblen < 1)
+                  {
+                    mblen = 1;
+                    str += "?";
+                    if (! warned)
+                      {
+                        warning_with_id ("Octave:print:unhandled-character",
+                                         "print: only ASCII characters are "
+                                         "supported for EPS and derived "
+                                         "formats.");
+                        warned = true;
+                      }
+                  }
                 else
                   str += tmpstr.at (i);