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

About coding-system of Emacs-W3m.



Hi.

I'm use Emacs-W3m (version: 1.5) in Emacs (version: 23.0.60.2).

Now i have a question about coding-system of Emacs-W3m.

I have install Google Desktop Search in Debian.
And Emacs-W3m handle search result form Google Desktop Search, and display perfect.

And in result pages that Google Desktop Search return, in fact, every search item is a file-path that
search in my computer.

So i write a function to open these file-path in Emacs-W3m:

--------------------------> function start <-------------------------------------
(defun w3m-google-desktop-url-open ()
  "Open file link that Google Desktop Search show."
  (interactive)
  (let ((file (w3m-print-this-url))
        (url (w3m-print-current-url))
        (google-search-url google-desktop-search-url)) ;google-search-url is unique string that generate by Google Desktop Search
					;in my system this search-url is 'http://127.0.0.1:38923/?hl=zh_CN&s=vhITkQ_HHma9o9JG6cj-xJjhra0'
    (string-match "/\\?.*" google-search-url)
    (setq google-search-url (replace-match "" nil nil google-search-url 0))
    (if (string-match google-search-url url) ;if is the result of Google Desktop Search
        (progn
          (string-match ".*&url=file://" file) ;cut front of file
          (setq file (replace-match "" nil nil file 0))
          (string-match "&s.*" file)			;cut behind of file
          (setq file (replace-match "" nil nil file 0)) ;get local file path
	  (open-file file))		;open file is my function for open diversified files
      (message "This not a valid Google Desktop Search result."))))
-------------------------> function end <-------------------------------------------

So problem is if file-path is English, and it's all right.
But in file-path have Chinese, my function can't handle these coding of file-path, but Emacs-W3m can
handle these file-path's coding (UTF-8).

Example, have a file name that display in Emacs-W3m is "Emacs 手册.pdf", and i use
w3m-print-this-url, get information likes this:
"http://127.0.0.1:38923/redir?event_id=18772&hl=zh_CN&q=%e6%b5%8b%e8%af%95%20filetype%3apdf&schema=1&schema_id=1&seq=6&src=1&url=file%3a%2f%2f%2fdata%2fBook%2fEmacs%2fEmacs%20%7eE6%7e89%7e8B%7eE5%7e86%7e8C.pdf&s=_W2XahH28xBYa9lEO8UTc58O-wI";.

And if we pass above url to function 'w3m-google-desktop-url-open', i get it's file-path is like this:
"/data/Book/Emacs/Emacs ~E6~89~8B~E5~86~8C.pdf".

So i know Emacs-W3m can decode it (because it can display it), but i can't find which function can do
this.

Can you tell me where i can find this function?

Thank you very much!