summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2013-12-03 14:21:13 +0200
committerEli Zaretskii <eliz@gnu.org>2013-12-03 14:21:13 +0200
commitd45c90885962da97a8d72d2ffb8ce38046d8cb58 (patch)
tree6eaf922e1456fc625b681df891a9ce627d3f75f6
parent051546df1a4e52c44b612853fa14a653bc082860 (diff)
Fixed drag-n-drop with Unicode file names.
-rw-r--r--lisp/dnd.el11
-rw-r--r--lisp/net/browse-url.el9
-rw-r--r--lisp/term/w32-win.el9
3 files changed, 20 insertions, 9 deletions
diff --git a/lisp/dnd.el b/lisp/dnd.el
index d9061273c3..a4aa4f4558 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -152,10 +152,13 @@ Return nil if URI is not a local file."
(let ((f (cond ((string-match "^file:///" uri) ; XDND format.
(substring uri (1- (match-end 0))))
((string-match "^file:" uri) ; Old KDE, Motif, Sun
- (substring uri (match-end 0))))))
- (and f (setq f (decode-coding-string (dnd-unescape-uri f)
- (or file-name-coding-system
- default-file-name-coding-system))))
+ (substring uri (match-end 0)))))
+ (coding (if (equal system-type 'windows-nt)
+ ;; W32 pretends that file names are UTF-8 encoded.
+ 'utf-8
+ (or file-name-coding-system
+ default-file-name-coding-system))))
+ (and f (setq f (decode-coding-string (dnd-unescape-uri f) coding)))
(when (and f must-exist (not (file-readable-p f)))
(setq f nil))
f))
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index ff654f2374..461a054382 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
(defun browse-url-file-url (file)
"Return the URL corresponding to FILE.
Use variable `browse-url-filename-alist' to map filenames to URLs."
- (let ((coding (and (default-value 'enable-multibyte-characters)
- (or file-name-coding-system
- default-file-name-coding-system))))
+ (let ((coding (if (equal system-type 'windows-nt)
+ ;; W32 pretends that file names are UTF-8 encoded.
+ 'utf-8
+ (and (default-value 'enable-multibyte-characters)
+ (or file-name-coding-system
+ default-file-name-coding-system)))))
(if coding (setq file (encode-coding-string file coding))))
(setq file (browse-url-url-encode-chars file "[*\"()',=;?% ]"))
(dolist (map browse-url-filename-alist)
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 513a99d491..af1a351c0a 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -110,8 +110,13 @@
(let ((f (if (eq system-type 'cygwin)
(cygwin-convert-file-name-from-windows file-name t)
(subst-char-in-string ?\\ ?/ file-name)))
- (coding (or file-name-coding-system
- default-file-name-coding-system)))
+ (coding (if (eq system-type 'windows-nt)
+ ;; Native w32 build pretends that its file names
+ ;; are encoded in UTF-8, and converts to the
+ ;; appropriate encoding internally.
+ 'utf-8
+ (or file-name-coding-system
+ default-file-name-coding-system))))
(setq file-name
(mapconcat 'url-hexify-string