unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ikumi Keita <ikumi@ikumi.que.jp>
Cc: 63644@debbugs.gnu.org
Subject: bug#63644: 29.0.91; Coding system detection defect in html
Date: Mon, 22 May 2023 19:04:02 +0300	[thread overview]
Message-ID: <83mt1wpd3h.fsf@gnu.org> (raw)
In-Reply-To: <82357.1684763963@localhost> (message from Ikumi Keita on Mon, 22 May 2023 22:59:23 +0900)

> From: Ikumi Keita <ikumi@ikumi.que.jp>
> Date: Mon, 22 May 2023 22:59:23 +0900
> 
> 0. Save the following file as /tmp/foo.html with the coding system `euc-jp':
> ----------------------------------------------------------------------
> <!DOCTYPE html>
> <html lang="ja">
> <head>
> <meta charset="EUC-JP">
> <title>dummy</title>
> </head>
> <body>
> あいうえお
> </body></html>
> ----------------------------------------------------------------------
> 1. emacs -Q
> 2. C-x C-f /tmp/foo.html RET
> 3. M-: (sgml-html-meta-auto-coding-function 1000) RET
> 4. Then emacs signals error with the following backtrace:
> Debugger entered--Lisp error: (coding-system-error iso-2022)
>   coding-system-plist(iso-2022)
>   coding-system-equal(utf-8 iso-2022)
>   sgml-html-meta-auto-coding-function(1000)
>   eval((sgml-html-meta-auto-coding-function 1000) t)
>   eval-expression((sgml-html-meta-auto-coding-function 1000) nil nil 127)
>   funcall-interactively(eval-expression (sgml-html-meta-auto-coding-function 1000) nil nil 127)
>   call-interactively(eval-expression nil nil)
>   command-execute(eval-expression)

Thanks.  Does the patch below give good results?

diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 25b90b4..2b44a2e 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -2484,10 +2484,12 @@ sgml-xml-auto-coding-function
                     ;; called as part of visiting a file, as opposed
                     ;; to when saving a buffer to a file.
                     (if (and enable-multibyte-characters
-                             ;; 'charset' will signal an error in
-                             ;; coding-system-equal, since it isn't a
-                             ;; coding-system.  So test that up front.
+                             ;; 'charset' and 'iso-2022' will signal
+                             ;; an error in coding-system-equal, since
+                             ;; they aren't coding-systems.  So test
+                             ;; that up front.
                              (not (equal sym-type 'charset))
+                             (not (equal sym-type 'iso-2022))
                              (coding-system-equal 'utf-8 sym-type)
                              (coding-system-equal 'utf-8 bfcs-type))
                         buffer-file-coding-system
@@ -2540,11 +2542,13 @@ sgml-html-meta-auto-coding-function
                   (bfcs-type
                    (coding-system-type buffer-file-coding-system)))
               (if (and enable-multibyte-characters
-                       ;; 'charset' will signal an error in
-                       ;; coding-system-equal, since it isn't a
-                       ;; coding-system.  So test that up front.
+                       ;; 'charset' and 'iso-2022' will signal an error
+                       ;; in coding-system-equal, since they aren't
+                       ;; coding-systems.  So test that up front.
                        (not (equal sym-type 'charset))
                        (not (equal bfcs-type 'charset))
+                       (not (equal sym-type 'iso-2022))
+                       (not (equal bfcs-type 'iso-2022))
                        (coding-system-equal 'utf-8 sym-type)
                        (coding-system-equal 'utf-8 bfcs-type))
                   buffer-file-coding-system





  reply	other threads:[~2023-05-22 16:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 13:59 bug#63644: 29.0.91; Coding system detection defect in html Ikumi Keita
2023-05-22 16:04 ` Eli Zaretskii [this message]
2023-05-22 16:42   ` Ikumi Keita
2023-05-22 18:25     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83mt1wpd3h.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=63644@debbugs.gnu.org \
    --cc=ikumi@ikumi.que.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).