2019-02-27 Robert Pluim <rpluim@gmail.com>
* lisp/net/eww.el (eww-display-html): Replace NUL characters with
"\0", as libxml can't handle embedded NULLs. (Bug#34469)
(condition-case nil
(decode-coding-region (point) (point-max) encode)
(coding-system-error nil))
- (save-excursion
- ;; Remove CRLF before parsing.
- (while (re-search-forward "\r$" nil t)
- (replace-match "" t t)))
+ (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)))
(libxml-parse-html-region (point) (point-max))))))
(source (and (null document)
(buffer-substring (point) (point-max)))))