[Git][cmucl/cmucl][issue-139-set-terminal-to-utf8] Apply 1 suggestion(s) to 1 file(s)

Raymond Toy (@rtoy) gitlab at common-lisp.net
Sun Dec 4 15:27:58 UTC 2022



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/cd9ba2f1d7f610baefabf8b0798d387737108bdd

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/cd9ba2f1d7f610baefabf8b0798d387737108bdd
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20221204/627d352a/attachment-0001.html>


More information about the cmucl-cvs mailing list