Raymond Toy pushed to branch issue-139-set-terminal-to-utf8 at cmucl / cmucl
Commits: cd9ba2f1 by Carl S. Shapiro at 2022-12-04T15:27:49+00:00 Apply 1 suggestion(s) to 1 file(s) - - - - -
1 changed file:
- src/code/save.lisp
Changes:
===================================== src/code/save.lisp ===================================== @@ -145,26 +145,22 @@ (defun set-up-locale-external-format () "Add external format alias for :locale to the format specified by the locale as set by setlocale(3C)." - (let ((codeset (unix::unix-get-locale-codeset))) + (let ((codeset (unix::unix-get-locale-codeset)) + (external-format nil)) (cond ((zerop (length codeset)) - ;; Codeset was the empty string, so just set :locale to - ;; alias to the default external format. + (setq external-format *default-external-format*)) + (t + (let ((name (intern codeset "KEYWORD"))) + (setq external-format (stream::find-external-format name nil))))) + (cond (external-format (setf (gethash :locale stream::*external-format-aliases*) - *default-external-format*)) + external-format)) (t - ;; If we know the format. This could be an alias to - ;; another format and so on, so use FIND-EXTERNAL-FORMAT - ;; to determine the final format and use that as the - ;; alias. - (let* ((codeset-format (intern codeset "KEYWORD")) - (final-format (stream::find-external-format codeset-format))) - (setf (gethash :locale stream::*external-format-aliases*) - (if final-format - (stream::ef-name final-format) - (progn - (warn "Unsupported external format; using :iso8859-1 instead: ~S" - codeset-format) - :iso8859-1))))))) + (warn "No external format found for codeset "~S"; using ~S instead" + codeset + *default-external-format*) + (setf (gethash :locale stream::*external-format-aliases*) + *default-external-format*)))) (values))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/cd9ba2f1d7f610baefabf8b0...