]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid bugging out on multibyte SVG data in shr
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 1 Oct 2019 19:51:23 +0000 (21:51 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 1 Oct 2019 19:51:23 +0000 (21:51 +0200)
* lisp/net/shr.el (svg--wrap-svg): Ensure that the SVG data is
unibyte.

lisp/net/shr.el

index dc3cc38c7989d0a4153d0a40607e5ef55434f8a7..ef236bf7c482e84b79a3456e3389d0d9710c04e3 100644 (file)
@@ -1199,7 +1199,9 @@ Return a string with image data."
         "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xi=\"http://www.w3.org/2001/XInclude\" style=\"color: %s;\" viewBox=\"0 0 %d %d\"> <xi:include href=\"data:image/svg+xml;base64,%s\"></xi:include></svg>"
         (face-foreground 'default)
         (car size) (cdr size)
-        (base64-encode-string data t)))
+        (base64-encode-string (encode-coding-string
+                               data (car (detect-coding-string data)))
+                              t)))
       (buffer-string))))
 
 (defun shr-image-displayer (content-function)