Function: tramp-get-remote-locale

tramp-get-remote-locale is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-get-remote-locale VEC)

Documentation

Determine remote locale, supporting UTF8 if possible.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-get-remote-locale (vec)
  "Determine remote locale, supporting UTF8 if possible."
  (with-tramp-connection-property vec "locale"
    (tramp-send-command vec "locale -a")
    (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8" "C.UTF-8"))
	  locale)
      (with-current-buffer (tramp-get-connection-buffer vec)
	(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.
      (format "LC_ALL=%s" (or locale "C")))))