GNU bug report logs - #79613
Returned value of decode-coding-string : mismatched document?

Previous Next

Package: emacs;

Reported by: "ISHIKAWA,chiaki" <ishikawa <at> yk.rim.or.jp>

Date: Fri, 10 Oct 2025 18:47:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

To reply to this bug, email your comments to 79613 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79613; Package emacs. (Fri, 10 Oct 2025 18:47:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "ISHIKAWA,chiaki" <ishikawa <at> yk.rim.or.jp>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 10 Oct 2025 18:47:02 GMT) Full text and rfc822 format available.

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

From: "ISHIKAWA,chiaki" <ishikawa <at> yk.rim.or.jp>
To: bug-gnu-emacs <at> gnu.org
Cc: "ishikawa, chiaki" <ishikawa <at> yk.rim.or.jp>
Subject: Returned value of decode-coding-string : mismatched document?
Date: Sat, 11 Oct 2025 03:45:59 +0900
Hi,

While trying to update somewhat outdated tamago Japanese system written 
in Emacs/Lisp to fit the modern Emacs world for my personal use
(I am using Emacs 30.2) and try to
replace old/obsoleted string-as-multibyte with decode-coding-string, I 
came across a subtle mismatch of
documentation or function returned value.

In the documentation page, say, available online at 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Explicit-Encoding.html
There is a paragraph titled as "Function: decode-coding-string string 
coding-system &optional nocopy buffer ¶"

In the paragraph, there is a coding example as follows.

(decode-coding-string "Gr\374ss Gott" 'latin-1)
     ⇒ #("Grüss Gott" 0 9 (charset iso-8859-1))

Note that there is the pair of numbers 0 9 in the expected output.

However when I evaluate the above expression in *scratch* buffer of my 
local Emacs.
(Emacs 30.2)

(decode-coding-string "Gr\374ss Gott" 'latin-1)
returned

#("Grüss Gott" 0 10 (charset iso-8859-1))


Note the number pair changes into 0 10 in the result  and not 0 9 in the 
manual.

One of them is incorrect IMHO.

Thank you in advance for your attention on this matter.

Happy Hacking (in the good old sense of the phrase).

Chiaki Ishikawa

PS: my thunderbird e-mail client *may* have change the coding of the 
above string (especially the resulting string). But please disregard that.
My point is in the difference of number 9 and 10. Presumably it is the 
perceived length of the result?






Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 11 Oct 2025 06:49:01 GMT) Full text and rfc822 format available.

Notification sent to "ISHIKAWA,chiaki" <ishikawa <at> yk.rim.or.jp>:
bug acknowledged by developer. (Sat, 11 Oct 2025 06:49:02 GMT) Full text and rfc822 format available.

Message #10 received at 79613-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "ISHIKAWA,chiaki" <ishikawa <at> yk.rim.or.jp>
Cc: 79613-done <at> debbugs.gnu.org
Subject: Re: bug#79613: Returned value of decode-coding-string : mismatched
 document?
Date: Sat, 11 Oct 2025 09:48:39 +0300
> Cc: "ishikawa, chiaki" <ishikawa <at> yk.rim.or.jp>
> Date: Sat, 11 Oct 2025 03:45:59 +0900
> From: "ISHIKAWA,chiaki" <ishikawa <at> yk.rim.or.jp>
> 
> While trying to update somewhat outdated tamago Japanese system written 
> in Emacs/Lisp to fit the modern Emacs world for my personal use
> (I am using Emacs 30.2) and try to
> replace old/obsoleted string-as-multibyte with decode-coding-string, I 
> came across a subtle mismatch of
> documentation or function returned value.
> 
> In the documentation page, say, available online at 
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Explicit-Encoding.html
> There is a paragraph titled as "Function: decode-coding-string string 
> coding-system &optional nocopy buffer ¶"
> 
> In the paragraph, there is a coding example as follows.
> 
> (decode-coding-string "Gr\374ss Gott" 'latin-1)
>       ⇒ #("Grüss Gott" 0 9 (charset iso-8859-1))
> 
> Note that there is the pair of numbers 0 9 in the expected output.
> 
> However when I evaluate the above expression in *scratch* buffer of my 
> local Emacs.
> (Emacs 30.2)
> 
> (decode-coding-string "Gr\374ss Gott" 'latin-1)
> returned
> 
> #("Grüss Gott" 0 10 (charset iso-8859-1))
> 
> 
> Note the number pair changes into 0 10 in the result  and not 0 9 in the 
> manual.
> 
> One of them is incorrect IMHO.

Thanks, fixed on the emacs-30 branch, and closing the bug.




This bug report was last modified 26 days ago.

Previous Next


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