From fcb4d836f01cbec30cb5f906941179c566414b81 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 5 Jun 2022 21:16:09 +0800 Subject: [PATCH] Fix file name encoding of Motif drop protocol file selections * lisp/select.el (xselect-convert-to-filename): (xselect-convert-to-dt-netfile): Encode in the file name coding system instead of `raw-text-unix'. --- lisp/select.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/select.el b/lisp/select.el index c5412f2a73b..83dc137e239 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -633,7 +633,8 @@ two markers or an overlay. Otherwise, it is nil." ;; Motif expects this to be STRING, but it treats the data as ;; a sequence of bytes instead of a Latin-1 string. (cons 'STRING (encode-coding-string (expand-file-name value) - 'raw-text-unix)) + (or file-name-coding-system + default-file-name-coding-system))) (when (vectorp value) (with-temp-buffer (cl-loop for file across value @@ -643,7 +644,8 @@ two markers or an overlay. Otherwise, it is nil." (delete-char -1)) ;; Motif wants STRING. (cons 'STRING (encode-coding-string (buffer-string) - 'raw-text-unix))))))) + (or file-name-coding-system + default-file-name-coding-system)))))))) (defun xselect-convert-to-charpos (_selection _type value) (when (setq value (xselect--selection-bounds value)) @@ -771,8 +773,11 @@ VALUE should be SELECTION's local value." (stringp value) (file-exists-p value) (not (file-remote-p value))) - (encode-coding-string (xselect-tt-net-file value) - 'raw-text-unix t))) + (cons 'STRING + (encode-coding-string (xselect-tt-net-file value) + (or file-name-coding-system + default-file-name-coding-system) + t)))) (setq selection-converter-alist '((TEXT . xselect-convert-to-string) -- 2.39.2