GNU bug report logs - #7279
24.0.50; print-escape-multibyte not honored

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Mon, 25 Oct 2010 11:36:01 UTC

Severity: normal

Tags: notabug

Found in version 24.0.50

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #18 received at control <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Helmut Eller <eller.helmut <at> gmail.com>
Cc: 7279 <at> debbugs.gnu.org, Andreas Schwab <schwab <at> linux-m68k.org>
Subject: Re: bug#7279: 24.0.50; print-escape-multibyte not honored
Date: Mon, 30 Jan 2017 02:12:58 -0500
tags 7279 notabug
close 7279
quit

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

> * Andreas Schwab [2010-10-25 18:02] writes:
>
>> Helmut Eller <eller.helmut <at> 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))))




This bug report was last modified 8 years and 118 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.