[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] Re: A patch to Support filename encoding other than
From: |
Li Daobing |
Subject: |
[emacs-wiki-discuss] Re: A patch to Support filename encoding other than iso-8859-1 |
Date: |
Fri, 11 Feb 2005 21:07:42 +0800 |
In order to support the blank space in the filename, I did one more
patch, the diff in the following text is the total diff of these two
patches:
I don't know why in the old version the blank space was converted to "+".
--- emacs-wiki-publish.el.old 2005-02-11 20:57:23.000000000 +0800
+++ emacs-wiki-publish.el.new 2005-02-11 20:54:51.000000000 +0800
@@ -1231,6 +1231,11 @@
(delete-char -1)
(insert "&")))))
+(defcustom emacs-wiki-publish-url-coding-system 'utf-8
+ "*Default coding system used to encode url strings"
+ :group 'emacs-wiki-publish
+ :type '(coding-system :size 0))
+
;; Copied from w3m-url-encode-string (w3m.el)
(defun emacs-wiki-escape-url (str &optional coding)
"Hexify dangerous characters in STR.
@@ -1246,11 +1251,15 @@
((string-match "[-a-zA-Z0-9_:/.]" (char-to-string ch))
(char-to-string ch)) ; printable
((char-equal ch ?\x20) ; space
- "+")
+ "%20")
(t
(format "%%%02x" ch)))) ; escape
;; Coerce a string to a list of chars.
- (string-to-list str)))))
+ (append (encode-coding-string str
+ (or coding
+ emacs-wiki-publish-url-coding-system
+ 'utf-8))
+ nil)))))
;; we currently only do this on links. this means a stray '&' in an
;; emacs-wiki document risks being misinterpreted when being
On Thu, 10 Feb 2005 05:00:12 +0800, Li Daobing <address@hidden> wrote:
> you can access this patch from
> http://lidaobing.gnway.net/~nichloas/archives/address@hidden/emacs-wiki/
>
> --- orig/emacs-wiki-publish.el
> +++ mod/emacs-wiki-publish.el
> @@ -1231,6 +1231,11 @@
> (delete-char -1)
> (insert "&")))))
>
> +(defcustom emacs-wiki-publish-url-coding-system 'utf-8
> + "*Default coding system used to encode url strings"
> + :group 'emacs-wiki-publish
> + :type '(coding-system :size 0))
> +
> ;; Copied from w3m-url-encode-string (w3m.el)
> (defun emacs-wiki-escape-url (str &optional coding)
> "Hexify dangerous characters in STR.
> @@ -1250,7 +1255,11 @@
> (t
> (format "%%%02x" ch)))) ; escape
> ;; Coerce a string to a list of chars.
> - (string-to-list str)))))
> + (append (encode-coding-string str
> + (or coding
> +
> emacs-wiki-publish-url-coding-system
> + 'utf-8))
> + nil)))))
>
> ;; we currently only do this on links. this means a stray '&' in an
> ;; emacs-wiki document risks being misinterpreted when being
>