* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-attributes):
Parse multibyte symlinks correctly.
* test/lisp/net/tramp/tramp-tests.el (tramp--test-utf8):
Improve backward compatibility.
(setq dirp (if (equal "directory" (cdr (assoc "type" attributes))) t))
(setq res-symlink-target
(cdr (assoc "standard::symlink-target" attributes)))
+ (when (stringp res-symlink-target)
+ (setq res-symlink-target
+ ;; Parse unibyte codes "\xNN". We assume they are
+ ;; non-ASCII codepoints in the range #x80 through #xff.
+ ;; Convert them to multibyte.
+ (decode-coding-string
+ (replace-regexp-in-string
+ "\\\\x\\([[:xdigit:]]\\{2\\}\\)"
+ (lambda (x)
+ (unibyte-string (string-to-number (match-string 1 x) 16)))
+ res-symlink-target)
+ 'utf-8)))
;; ... number links
(setq res-numlinks
(string-to-number
(and
(stringp (setq x (eval (get-language-info (car x) 'sample-text))))
(not (unencodable-char-position
- 0 nil file-name-coding-system nil x))
+ 0 (length x) file-name-coding-system nil x))
;; ?\n and ?/ shouldn't be part of any file name. ?\t,
;; ?. and ?? do not work for "smb" method.
(replace-regexp-in-string "[\t\n/.?]" "" x)))