[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: emacs-w3m and w3mmee problems



Hi,

Thank you for your bug report, and I apologize for my slow reply.

>> On Tue, 10 Jun 2003 12:29:58 +0300
>> pgas@intracom.gr (Pierre Gaston) said as follows:

>I have some problems using emacs-w3m eand w3mmee:

> - http://www.emacswiki.org/cgi-bin/emacs-fr.pl is correctly displayed 
>using utf-8 but i can't follow the links because the url is not
>encoded. (If you give me some clue on how url is encoded I might help
>to find a solution).

Could you try the attached patch?

-- 
TSUCHIYA Masatoshi

--- w3m.el	12 Jun 2003 11:57:44 -0000	1.796
+++ w3m.el	15 Jun 2003 10:09:25 -0000
@@ -2253,6 +2253,19 @@
 					    'iso-2022-7bit))
 		  nil))))
 
+(defun w3m-url-safe-encode-string (url &optional coding)
+  (let ((start 0)
+	(buf))
+    (while (string-match "[^\x20-\x7e]+" url start)
+      (setq buf
+	    (cons (save-match-data
+		    (w3m-url-encode-string (match-string 0 url) coding))
+		  (cons (substring url start (match-beginning 0))
+			buf))
+	    start (match-end 0)))
+    (apply 'concat
+	   (nreverse (cons (substring url start) buf)))))
+
 (defun w3m-url-decode-string (str &optional coding)
   (let ((start 0)
 	(buf))
@@ -5996,7 +6009,8 @@
     nil ;; handler
     t)) ;; qsearch
   (set-text-properties 0 (length url) nil url)
-  (setq url (w3m-uri-replace url))
+  (setq url (w3m-url-safe-encode-string (w3m-uri-replace url)
+					w3m-current-coding-system))
   (cond
    ;; process mailto: protocol
    ((string-match "\\`mailto:\\(.*\\)" url)