(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 � before parsing.
+ (while (re-search-forward "\\(\r$\\)\\|\0" nil t)
+ (replace-match (if (match-beginning 1) "" "�") t t)))
(libxml-parse-html-region (point) (point-max))))))
(source (and (null document)
(buffer-substring (point) (point-max)))))