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

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

bug#30789: 26.0.91; xml-parse-region works but libxml-parse-html-region


From: Katsumi Yamaoka
Subject: bug#30789: 26.0.91; xml-parse-region works but libxml-parse-html-region doesn't
Date: Tue, 13 Mar 2018 12:31:09 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-unknown-cygwin)

On Tue, 13 Mar 2018 11:28:45 +0900, Katsumi Yamaoka wrote:
> +     ;; Remove extra bytes in utf-8 encoded data.
> +     (when (eq coding 'utf-8)
> +       (goto-char (point-min))
> +       (while (re-search-forward "[\x00-\x7f]+\\([\x80-\xbf]\\)" nil t)
> +         (replace-match "\\1")))

Corrected:
--- mm-decode.el~       2018-02-28 02:01:37.897607000 +0000
+++ mm-decode.el        2018-03-13 03:27:56.885844100 +0000
@@ -1810,6 +1810,13 @@
       (when (and (or coding
                     (setq coding (mm-charset-to-coding-system charset nil t)))
                 (not (eq coding 'ascii)))
+       ;; Remove extra bytes in utf-8 encoded data.
+       (when (eq coding 'utf-8)
+         (goto-char (point-min))
+         (while (re-search-forward
+                 "\\([\xc2-\xf7][\x80-\xbf]?\\)[\x00-\x7f]+\\([\x80-\xbf]\\)"
+                 nil t)
+           (replace-match "\\1\\2")))
        (insert (prog1
                    (decode-coding-string (buffer-string) coding)
                  (erase-buffer)

reply via email to

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