Function: tramp-get-local-locale
tramp-get-local-locale is a byte-compiled function defined in
tramp.el.gz.
Signature
(tramp-get-local-locale &optional VEC)
Documentation
Determine locale, supporting UTF8 if possible.
VEC is used for tracing.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-get-local-locale (&optional vec)
"Determine locale, supporting UTF8 if possible.
VEC is used for tracing."
;; 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 (eq system-type 'windows-nt)
(not (zerop (tramp-call-process
nil "locale" nil t nil "-a"))))
(while candidates
(goto-char (point-min))
(if (string-match-p
(tramp-compat-rx bol (literal (car candidates)) (? "\r") eol)
(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"))))