From: Stefan Monnier Date: Wed, 16 Nov 2005 19:05:38 +0000 (+0000) Subject: (url-insert-file-contents): Use the charset info X-Git-Tag: emacs-pretest-22.0.90~5839 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=77f05e24e88e65102b32d0c881fbb633ef64f1c8;p=emacs.git (url-insert-file-contents): Use the charset info provided by the HTTP server, if any. --- diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index f45c73216f7..e0a68349ce1 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,9 +1,14 @@ +2005-11-16 Juergen Hoetzel (tiny change) + + * url-handlers.el (url-insert-file-contents): Use the charset info + provided by the HTTP server, if any. + 2005-10-20 CHENG Gao (tiny change) - * url-nfs.el (top level): - * url-handlers.el (directory-files): + * url-nfs.el (top level): + * url-handlers.el (directory-files): * url-file.el (top level): - * url-dired.el (url-dired-minor-mode-map): + * url-dired.el (url-dired-minor-mode-map): * url-http.el (url-http-chunked-encoding-after-change-function): Remove XEmacs support. diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index 4fa52572a94..1c9d1d9c0b1 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el @@ -202,6 +202,7 @@ accessible." (defun url-insert-file-contents (url &optional visit beg end replace) (let ((buffer (url-retrieve-synchronously url)) (handle nil) + (charset nil) (data nil)) (if (not buffer) (error "Opening input file: No such file or directory, %s" url)) @@ -215,13 +216,14 @@ accessible." (mm-destroy-parts handle) (if replace (delete-region (point-min) (point-max))) (save-excursion + (setq charset (mail-content-type-get (mm-handle-type handle) + 'charset)) (let ((start (point))) - (insert data) - ;; FIXME: for text/plain data, we sometimes receive a `charset' - ;; annotation which we could use as a hint of the locale in use - ;; at the remote site. Not sure how/if that should be done. --Stef - (decode-coding-inserted-region - start (point) url visit beg end replace))) + (if charset + (insert (mm-decode-string data (mm-charset-to-coding-system charset))) + (progn + (insert data) + (decode-coding-inserted-region start (point) url visit beg end replace))))) (list url (length data)))) (defun url-file-name-completion (url directory)