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

About coding-system of Emacs-W3m.


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

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."
  (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 ''
    (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
          (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:

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

Can you tell me where i can find this function?

Thank you very much!