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 12:31:09 +0900	[thread overview]
Message-ID: <b4mpo48vegy.fsf@jpl.org> (raw)
In-Reply-To: <b4m60609866.fsf@jpl.org>

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

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:

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

--- 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)

  parent reply	other threads:[~2018-03-13  3:31 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
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 [this message]
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=b4mpo48vegy.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.