all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: "Lars Ingebrigtsen" <larsi@gnus.org>,
	"積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 30789@debbugs.gnu.org
Subject: bug#30789: 26.0.91; xml-parse-region works but libxml-parse-html-region doesn't
Date: Tue, 13 Mar 2018 11:28:45 +0900	[thread overview]
Message-ID: <b4m1sgowvxe.fsf@jpl.org> (raw)
In-Reply-To: <b4m60609866.fsf@jpl.org>

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

On Tue, 13 Mar 2018 01:44:22 +0100, Lars Ingebrigtsen wrote:
> libxml is more strict about correctness of the input than most other
> HTML parsers.  I don't think there's anything we can do about this
> problematic input other than ponder whether Emacs should use a different
> HTML parser, which I think sounds of unlikely.  :-)

I see.  I agree not to modify libxml.  Jidanni, how about trying
the following patch personally if you often get such broken mails?
Though I'm not quite sure if it does not cause another problem,
it fixes at least the mail in question.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 547 bytes --]

--- mm-decode.el~	2018-02-28 02:01:37.897607000 +0000
+++ mm-decode.el	2018-03-13 02:23:04.321753900 +0000
@@ -1810,6 +1810,11 @@
       (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 "[\x00-\x7f]+\\([\x80-\xbf]\\)" nil t)
+	    (replace-match "\\1")))
 	(insert (prog1
 		    (decode-coding-string (buffer-string) coding)
 		  (erase-buffer)

  reply	other threads:[~2018-03-13  2:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12 23:38 bug#30789: 26.0.91; xml-parse-region works but libxml-parse-html-region doesn't Katsumi Yamaoka
2018-03-13  0:44 ` Lars Ingebrigtsen
2018-03-13  2:28   ` Katsumi Yamaoka [this message]
2018-03-13  3:29     ` 積丹尼 Dan Jacobson
2018-03-13 11:28       ` Lars Ingebrigtsen
2018-03-13 20:27         ` 積丹尼 Dan Jacobson
2018-03-13 22:30           ` Lars Ingebrigtsen
2018-03-13  3:31     ` Katsumi Yamaoka
2018-03-13  2:55   ` 積丹尼 Dan Jacobson

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

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

  git send-email \
    --in-reply-to=b4m1sgowvxe.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=30789@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    --cc=larsi@gnus.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.