diff options
| author | Eli Zaretskii | 2013-12-03 14:21:13 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-12-03 14:21:13 +0200 |
| commit | d45c90885962da97a8d72d2ffb8ce38046d8cb58 (patch) | |
| tree | 6eaf922e1456fc625b681df891a9ce627d3f75f6 | |
| parent | 051546df1a4e52c44b612853fa14a653bc082860 (diff) | |
| download | emacs-d45c90885962da97a8d72d2ffb8ce38046d8cb58.tar.gz emacs-d45c90885962da97a8d72d2ffb8ce38046d8cb58.zip | |
Fixed drag-n-drop with Unicode file names.
| -rw-r--r-- | lisp/dnd.el | 11 | ||||
| -rw-r--r-- | lisp/net/browse-url.el | 9 | ||||
| -rw-r--r-- | lisp/term/w32-win.el | 9 |
3 files changed, 20 insertions, 9 deletions
diff --git a/lisp/dnd.el b/lisp/dnd.el index d9061273c32..a4aa4f4558e 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el | |||
| @@ -152,10 +152,13 @@ Return nil if URI is not a local file." | |||
| 152 | (let ((f (cond ((string-match "^file:///" uri) ; XDND format. | 152 | (let ((f (cond ((string-match "^file:///" uri) ; XDND format. |
| 153 | (substring uri (1- (match-end 0)))) | 153 | (substring uri (1- (match-end 0)))) |
| 154 | ((string-match "^file:" uri) ; Old KDE, Motif, Sun | 154 | ((string-match "^file:" uri) ; Old KDE, Motif, Sun |
| 155 | (substring uri (match-end 0)))))) | 155 | (substring uri (match-end 0))))) |
| 156 | (and f (setq f (decode-coding-string (dnd-unescape-uri f) | 156 | (coding (if (equal system-type 'windows-nt) |
| 157 | (or file-name-coding-system | 157 | ;; W32 pretends that file names are UTF-8 encoded. |
| 158 | default-file-name-coding-system)))) | 158 | 'utf-8 |
| 159 | (or file-name-coding-system | ||
| 160 | default-file-name-coding-system)))) | ||
| 161 | (and f (setq f (decode-coding-string (dnd-unescape-uri f) coding))) | ||
| 159 | (when (and f must-exist (not (file-readable-p f))) | 162 | (when (and f must-exist (not (file-readable-p f))) |
| 160 | (setq f nil)) | 163 | (setq f nil)) |
| 161 | f)) | 164 | f)) |
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index ff654f23747..461a0543829 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el | |||
| @@ -723,9 +723,12 @@ interactively. Turn the filename into a URL with function | |||
| 723 | (defun browse-url-file-url (file) | 723 | (defun browse-url-file-url (file) |
| 724 | "Return the URL corresponding to FILE. | 724 | "Return the URL corresponding to FILE. |
| 725 | Use variable `browse-url-filename-alist' to map filenames to URLs." | 725 | Use variable `browse-url-filename-alist' to map filenames to URLs." |
| 726 | (let ((coding (and (default-value 'enable-multibyte-characters) | 726 | (let ((coding (if (equal system-type 'windows-nt) |
| 727 | (or file-name-coding-system | 727 | ;; W32 pretends that file names are UTF-8 encoded. |
| 728 | default-file-name-coding-system)))) | 728 | 'utf-8 |
| 729 | (and (default-value 'enable-multibyte-characters) | ||
| 730 | (or file-name-coding-system | ||
| 731 | default-file-name-coding-system))))) | ||
| 729 | (if coding (setq file (encode-coding-string file coding)))) | 732 | (if coding (setq file (encode-coding-string file coding)))) |
| 730 | (setq file (browse-url-url-encode-chars file "[*\"()',=;?% ]")) | 733 | (setq file (browse-url-url-encode-chars file "[*\"()',=;?% ]")) |
| 731 | (dolist (map browse-url-filename-alist) | 734 | (dolist (map browse-url-filename-alist) |
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 513a99d4914..af1a351c0ad 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el | |||
| @@ -110,8 +110,13 @@ | |||
| 110 | (let ((f (if (eq system-type 'cygwin) | 110 | (let ((f (if (eq system-type 'cygwin) |
| 111 | (cygwin-convert-file-name-from-windows file-name t) | 111 | (cygwin-convert-file-name-from-windows file-name t) |
| 112 | (subst-char-in-string ?\\ ?/ file-name))) | 112 | (subst-char-in-string ?\\ ?/ file-name))) |
| 113 | (coding (or file-name-coding-system | 113 | (coding (if (eq system-type 'windows-nt) |
| 114 | default-file-name-coding-system))) | 114 | ;; Native w32 build pretends that its file names |
| 115 | ;; are encoded in UTF-8, and converts to the | ||
| 116 | ;; appropriate encoding internally. | ||
| 117 | 'utf-8 | ||
| 118 | (or file-name-coding-system | ||
| 119 | default-file-name-coding-system)))) | ||
| 115 | 120 | ||
| 116 | (setq file-name | 121 | (setq file-name |
| 117 | (mapconcat 'url-hexify-string | 122 | (mapconcat 'url-hexify-string |