(get_doc_string): When UNIBYTE and DEFINITION are 0,
authorRichard M. Stallman <rms@gnu.org>
Tue, 6 Apr 1999 19:50:49 +0000 (19:50 +0000)
committerRichard M. Stallman <rms@gnu.org>
Tue, 6 Apr 1999 19:50:49 +0000 (19:50 +0000)
let the data control whether string is unibyte.

src/doc.c

index a28fd58..af7c55e 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -275,8 +275,15 @@ get_doc_string (filepos, unibyte, definition)
     return make_unibyte_string (get_doc_string_buffer + offset,
                                to - (get_doc_string_buffer + offset));
   else
-    return make_string (get_doc_string_buffer + offset,
-                       to - (get_doc_string_buffer + offset));
+    {
+      /* Let the data determine whether the string is multibyte,
+        even if Emacs is running in --unibyte mode.  */
+      int nchars = multibyte_chars_in_text (get_doc_string_buffer + offset,
+                                           to - (get_doc_string_buffer + offset));
+      return make_string_from_bytes (get_doc_string_buffer + offset,
+                                    nchars,
+                                    to - (get_doc_string_buffer + offset));
+    }
 }
 
 /* Get a string from position FILEPOS and pass it through the Lisp reader.