]> git.eshelyaron.com Git - emacs.git/commitdiff
(print) <Lisp_String>: When multibyte is enabled, print
authorKarl Heuer <kwzh@gnu.org>
Sun, 18 Jan 1998 04:51:16 +0000 (04:51 +0000)
committerKarl Heuer <kwzh@gnu.org>
Sun, 18 Jan 1998 04:51:16 +0000 (04:51 +0000)
single-byte non-ASCII chars using octal escapes.

src/print.c

index 038e6ff3d150389db4cdecc3a4588d70298acb9b..0d2a29cc5c1271c1ae63acff5834216bfb82c327 100644 (file)
@@ -1149,8 +1149,8 @@ print (obj, printcharfun, escapeflag)
                  PRINTCHAR ('\\');
                  PRINTCHAR ('f');
                }
-             else if (! SINGLE_BYTE_CHAR_P (c)
-                      && NILP (current_buffer->enable_multibyte_characters))
+             else if ((! SINGLE_BYTE_CHAR_P (c)
+                       && NILP (current_buffer->enable_multibyte_characters)))
                {
                  /* When multibyte is disabled,
                     print multibyte string chars using hex escapes.  */
@@ -1158,6 +1158,17 @@ print (obj, printcharfun, escapeflag)
                  sprintf (outbuf, "\\x%x", c);
                  strout (outbuf, -1, -1, printcharfun, 0);
                }
+             else if (SINGLE_BYTE_CHAR_P (c)
+                      && ! ASCII_BYTE_P (c)
+                      && ! NILP (current_buffer->enable_multibyte_characters))
+               {
+                 /* When multibyte is enabled,
+                    print single-byte non-ASCII string chars
+                    using octal escapes.  */
+                 unsigned char outbuf[5];
+                 sprintf (outbuf, "\\%03o", c);
+                 strout (outbuf, -1, -1, printcharfun, 0);
+               }
              else
                {
                  if (c == '\"' || c == '\\')