changeset 20670:b818d996d923

(print) <Lisp_String>: When multibyte is enabled, print single-byte non-ASCII chars using octal escapes.
author Karl Heuer <kwzh@gnu.org>
date Sun, 18 Jan 1998 04:51:16 +0000
parents fa76057543dd
children be91d6130341
files src/print.c
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/print.c	Sun Jan 18 04:49:11 1998 +0000
+++ b/src/print.c	Sun Jan 18 04:51:16 1998 +0000
@@ -1149,8 +1149,8 @@
 		  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 @@
 		  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 == '\\')