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

Re: emacs-w3m and w3mmee problems



 >- 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.

I don't know if it is usefull for you.

I used the following workaround to encode url get parameters according 
to the encoding of the page:

In w3m.el, I add in w3m-view-this-url-1 just after  (lexical-let (pos) :

    (setq url (replace-regexp-in-string
           "\\?.*"
           (lambda (param)
         (concat "?" (http-url-encode (substring param 1) 
buffer-file-coding-system))
             )
           url
           ))

where http-url-encode is

(defun http-url-encode (str content-type)
  "URL encode STR using CONTENT-TYPE as the coding system."
  (apply 'concat
     (mapcar (lambda (c)
           (if (or (and (>= c ?a) (<= c ?z))
               (and (>= c ?A) (<= c ?Z))
               (and (>= c ?0) (<= c ?9))
               (= c ?=)
               (= c ?&))
               (string c)
             (format "%%%02x" c)))
         (encode-coding-string str content-type))))