]> code.delx.au - gnu-emacs/commitdiff
Fixed drag-n-drop with Unicode file names.
authorEli Zaretskii <eliz@gnu.org>
Tue, 3 Dec 2013 12:21:13 +0000 (14:21 +0200)
committerEli Zaretskii <eliz@gnu.org>
Tue, 3 Dec 2013 12:21:13 +0000 (14:21 +0200)
lisp/dnd.el
lisp/net/browse-url.el
lisp/term/w32-win.el

index d9061273c32e9210cf899e2d82329b80e0002dea..a4aa4f4558ec9ebf32008aed47f594b72e31ed67 100644 (file)
@@ -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))
index ff654f2374701fddb3e2fcaabe45aefca4649b89..461a0543829781373f13c7ec4aead41a37a57280 100644 (file)
@@ -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)
index 513a99d4914e3b674dd8cbd80962ed8867a707ec..af1a351c0ad81c488be8b8436d688a87aff7f987 100644 (file)
   (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