diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/tramp-sh.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 20 |
2 files changed, 22 insertions, 2 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 9fa46109a5a..5b9083203b5 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2865,7 +2865,7 @@ This is like `dired-recursive-delete-directory' for Tramp files." (narrow-to-region (point) (point)) ;; We cannot use `insert-buffer-substring' because the Tramp ;; buffer changes its contents before insertion due to calling - ;; `expand-file' and alike. + ;; `expand-file-name' and alike. (insert (with-current-buffer (tramp-get-buffer v) (buffer-string))) @@ -4865,7 +4865,7 @@ connection if a previous connection has died for some reason." (when (and p (processp p)) (delete-process p)) (setenv "TERM" tramp-terminal-type) - (setenv "LC_ALL" "en_US.utf8") + (setenv "LC_ALL" (tramp-get-local-locale vec)) (if (stringp tramp-histfile-override) (setenv "HISTFILE" tramp-histfile-override) (if tramp-histfile-override diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 43962169d5a..19dced6c2f3 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3939,6 +3939,26 @@ This is used internally by `tramp-file-mode-from-int'." (tramp-compat-funcall 'group-gid) (nth 3 (tramp-compat-file-attributes "~/" id-format)))) +(defun tramp-get-local-locale (&optional vec) + ;; We use key nil for local connection properties. + (with-tramp-connection-property nil "locale" + (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8")) + locale) + (with-temp-buffer + (unless (or (memq system-type '(windows-nt)) + (not (zerop (tramp-call-process + nil "locale" nil t nil "-a")))) + (while candidates + (goto-char (point-min)) + (if (string-match (format "^%s\r?$" (regexp-quote (car candidates))) + (buffer-string)) + (setq locale (car candidates) + candidates nil) + (setq candidates (cdr candidates)))))) + ;; Return value. + (when vec (tramp-message vec 7 "locale %s" (or locale "C"))) + (or locale "C")))) + ;;;###tramp-autoload (defun tramp-check-cached-permissions (vec access) "Check `file-attributes' caches for VEC. |
