From 6d278f1c3d4f0f940c24b25ea534f0644f6a2a4d Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Fri, 19 Mar 2010 14:48:10 +0900 Subject: [PATCH] (www-format-encode-string): Display &U-hhhhhhhh;. (www-xml-format-props): Encode property value. (www-xml-format-unit): Encode string. --- cwiki-common.el | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cwiki-common.el b/cwiki-common.el index 4f62691..f6aa4ad 100644 --- a/cwiki-common.el +++ b/cwiki-common.el @@ -532,8 +532,8 @@ t 'literal)) (goto-char (point-min)) - (while (re-search-forward "&UU\\+\\([0-9A-F]+\\);" nil t) - (setq code (string-to-int (match-string 1) 16)) + (while (re-search-forward "&\\(UU\\+\\|U-\\)\\([0-9A-F]+\\);" nil t) + (setq code (string-to-int (match-string 2) 16)) (replace-match (format "\"UU+%04X\"" code @@ -721,14 +721,24 @@ (setq key (substring key 1))) (setq dest (format "%s %s=\"%s\"" - dest key val))) + dest key + (www-format-encode-string + (format "%s" val) 'without-tags)))) dest)) (defun www-xml-format-unit (format-unit) (let (name props children ret) (cond ((stringp format-unit) - format-unit) + (www-format-encode-string format-unit 'without-tags) + ;; (mapconcat (lambda (c) + ;; (cond + ;; ((eq c ?<) "&lt;") + ;; ((eq c ?>) "&gt;") + ;; (t + ;; (char-to-string c)))) + ;; format-unit "") + ) ((consp format-unit) (setq name (car format-unit) props (nth 1 format-unit) -- 1.7.10.4