diff options
| author | Stefan Monnier | 2005-11-16 19:05:38 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-11-16 19:05:38 +0000 |
| commit | 77f05e24e88e65102b32d0c881fbb633ef64f1c8 (patch) | |
| tree | c2d7295399672b56d562f2e4adbf4db76a977aa6 | |
| parent | 0a37f51211b54a8c47c5f00a8884f9f809872bc0 (diff) | |
| download | emacs-77f05e24e88e65102b32d0c881fbb633ef64f1c8.tar.gz emacs-77f05e24e88e65102b32d0c881fbb633ef64f1c8.zip | |
(url-insert-file-contents): Use the charset info
provided by the HTTP server, if any.
| -rw-r--r-- | lisp/url/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/url/url-handlers.el | 14 |
2 files changed, 16 insertions, 9 deletions
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 @@ | |||
| 1 | 2005-11-16 Juergen Hoetzel <emacs@hoetzel.info> (tiny change) | ||
| 2 | |||
| 3 | * url-handlers.el (url-insert-file-contents): Use the charset info | ||
| 4 | provided by the HTTP server, if any. | ||
| 5 | |||
| 1 | 2005-10-20 CHENG Gao <chenggao@gmail.com> (tiny change) | 6 | 2005-10-20 CHENG Gao <chenggao@gmail.com> (tiny change) |
| 2 | 7 | ||
| 3 | * url-nfs.el (top level): | 8 | * url-nfs.el (top level): |
| 4 | * url-handlers.el (directory-files): | 9 | * url-handlers.el (directory-files): |
| 5 | * url-file.el (top level): | 10 | * url-file.el (top level): |
| 6 | * url-dired.el (url-dired-minor-mode-map): | 11 | * url-dired.el (url-dired-minor-mode-map): |
| 7 | * url-http.el (url-http-chunked-encoding-after-change-function): | 12 | * url-http.el (url-http-chunked-encoding-after-change-function): |
| 8 | Remove XEmacs support. | 13 | Remove XEmacs support. |
| 9 | 14 | ||
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." | |||
| 202 | (defun url-insert-file-contents (url &optional visit beg end replace) | 202 | (defun url-insert-file-contents (url &optional visit beg end replace) |
| 203 | (let ((buffer (url-retrieve-synchronously url)) | 203 | (let ((buffer (url-retrieve-synchronously url)) |
| 204 | (handle nil) | 204 | (handle nil) |
| 205 | (charset nil) | ||
| 205 | (data nil)) | 206 | (data nil)) |
| 206 | (if (not buffer) | 207 | (if (not buffer) |
| 207 | (error "Opening input file: No such file or directory, %s" url)) | 208 | (error "Opening input file: No such file or directory, %s" url)) |
| @@ -215,13 +216,14 @@ accessible." | |||
| 215 | (mm-destroy-parts handle) | 216 | (mm-destroy-parts handle) |
| 216 | (if replace (delete-region (point-min) (point-max))) | 217 | (if replace (delete-region (point-min) (point-max))) |
| 217 | (save-excursion | 218 | (save-excursion |
| 219 | (setq charset (mail-content-type-get (mm-handle-type handle) | ||
| 220 | 'charset)) | ||
| 218 | (let ((start (point))) | 221 | (let ((start (point))) |
| 219 | (insert data) | 222 | (if charset |
| 220 | ;; FIXME: for text/plain data, we sometimes receive a `charset' | 223 | (insert (mm-decode-string data (mm-charset-to-coding-system charset))) |
| 221 | ;; annotation which we could use as a hint of the locale in use | 224 | (progn |
| 222 | ;; at the remote site. Not sure how/if that should be done. --Stef | 225 | (insert data) |
| 223 | (decode-coding-inserted-region | 226 | (decode-coding-inserted-region start (point) url visit beg end replace))))) |
| 224 | start (point) url visit beg end replace))) | ||
| 225 | (list url (length data)))) | 227 | (list url (length data)))) |
| 226 | 228 | ||
| 227 | (defun url-file-name-completion (url directory) | 229 | (defun url-file-name-completion (url directory) |