mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-02-02 20:16:25 +00:00
Fixed drag-n-drop with Unicode file names.
This commit is contained in:
parent
051546df1a
commit
d45c908859
11
lisp/dnd.el
11
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))
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user