bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7279: 24.0.50; print-escape-multibyte not honored


From: npostavs
Subject: bug#7279: 24.0.50; print-escape-multibyte not honored
Date: Mon, 30 Jan 2017 02:12:58 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

tags 7279 notabug
close 7279
quit

Helmut Eller <eller.helmut@gmail.com> writes:

> * Andreas Schwab [2010-10-25 18:02] writes:
>
>> Helmut Eller <eller.helmut@gmail.com> writes:
>>
>>> This code:
>>>
>>> (with-temp-file "/tmp/x.x"
>>>   (let ((print-escape-multibyte nil))
>>>     (prin1 (string ?\x03bb) (current-buffer))))
>>>
>>> writes "\x03bb" to the file, i.e. it seems to ignore the value
>>> of print-escape-multibyte.
>>
>> I cannot reprodoce that.  I also tried setting print-escape-multibyte to
>> t and got the expected effect.  Note that print-escape-multibyte is nil
>> by default anyway.
>
> And this?
>
> (with-temp-file "/tmp/x.x"
>   (set-buffer-multibyte nil)
>   (let ((print-escape-multibyte nil))
>     (prin1 (string ?\x80) (current-buffer))))
>

You can't print a multibyte string into a unibyte buffer, this works:

(with-temp-file "/tmp/x.x"
  (set-buffer-multibyte nil)
  (let ((print-escape-multibyte nil))
    (prin1 (unibyte-string ?\x80) (current-buffer))))

or if you want to handle unicode you must choose an encoding:

(with-temp-file "/tmp/x.x"
  (set-buffer-multibyte nil)
  (let ((print-escape-multibyte nil))
    (prin1 (encode-coding-string (string ?\x03bb) 'utf-8)
           (current-buffer))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]