diff options
-rw-r--r-- | lisp/svg.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/svg.el b/lisp/svg.el index 42619ed3519..ae7f1c57c02 100644 --- a/lisp/svg.el +++ b/lisp/svg.el @@ -161,9 +161,15 @@ otherwise. IMAGE-TYPE should be a MIME image type, like (defun svg--encode-text (text) ;; Apparently the SVG renderer needs to have all non-ASCII - ;; characters encoded. + ;; characters encoded, and only certain special characters. (with-temp-buffer - (insert (xml-escape-string text)) + (insert text) + (dolist (substitution '(("&" . "&") + ("<" . "<") + (">" . ">"))) + (goto-char (point-min)) + (while (search-forward (car substitution) nil t) + (replace-match (cdr substitution) t t nil))) (goto-char (point-min)) (while (not (eobp)) (let ((char (following-char))) |