]> git.eshelyaron.com Git - emacs.git/commitdiff
Escape HTML NUL as � in eww
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 27 Feb 2019 22:35:51 +0000 (14:35 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 27 Feb 2019 22:37:38 +0000 (14:37 -0800)
* lisp/net/eww.el (eww-display-html): Escape NUL as &#0; as this
is more appropriate for HTML.

lisp/net/eww.el

index 3ec6c1cfd3b6542de2fbe995ae6ab06cb9b98306..3e9334532c66f660191e7d59b5e34239f35d4451 100644 (file)
@@ -471,11 +471,9 @@ Currently this means either text/html or application/xhtml+xml."
                    (decode-coding-region (point) (point-max) encode)
                  (coding-system-error nil))
                (save-excursion
-                 ;; Remove CRLF and NULL before parsing.
-                  (while (re-search-forward "\\(\r$\\)\\|\\(\000\\)" nil t)
-                    (replace-match (if (match-beginning 1)
-                                       ""
-                                     "\\0") t t)))
+                 ;; Remove CRLF and replace NUL with &#0; before parsing.
+                 (while (re-search-forward "\\(\r$\\)\\|\0" nil t)
+                   (replace-match (if (match-beginning 1) "" "&#0;") t t)))
                (libxml-parse-html-region (point) (point-max))))))
        (source (and (null document)
                     (buffer-substring (point) (point-max)))))