[Git][cmucl/cmucl][issue-139-use-lang-to-set-external-format] Some cleanups so we don't change filename encoding.

Raymond Toy (@rtoy) gitlab at common-lisp.net
Fri Oct 7 22:16:44 UTC 2022



Raymond Toy pushed to branch issue-139-use-lang-to-set-external-format at cmucl / cmucl


Commits:
0c3c5d94 by Raymond Toy at 2022-10-07T15:16:25-07:00
Some cleanups so we don't change filename encoding.

* Clean up docstring for `setup-encodings`
* Don't change the filename-encoding in any of the cases.
* Fix message to say terminal encoding instead of filename encoding
  since we don't change the filename encoding.
* Update warning message to mention that the encodings are unchanged
  when given an unknown external format.

- - - - -


1 changed file:

- src/code/save.lisp


Changes:

=====================================
src/code/save.lisp
=====================================
@@ -143,10 +143,11 @@
   (initial-function (alien:unsigned #.vm:word-bits)))
 
 (defun setup-encodings (&optional quiet)
-  "Set up encodings based on the value of the LANG envvar.  The
-  codeset from LANG will be used to set *DEFAULT-EXTERNAL-FORMAT* and
-  sets the terminal and file name encoding to the specified codeset.
-  If Quiet is non-NIL, then messages will be suppressed."
+  "Set up encodings based on the value of the LANG and related
+  envvars.  The codeset from LANG will be used to set
+  *DEFAULT-EXTERNAL-FORMAT* and sets the terminal encoding to the
+  specified codeset.  If Quiet is non-NIL, then messages will be
+  suppressed."
   ;; Find the envvar that will tell us what encoding to use.
   ;;
   ;; See https://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html
@@ -164,14 +165,14 @@
 	 ;; If the lang is "C" or "POSIX", ignoring anything after
 	 ;; that, we need to set the format accordingly.
 	 (setf *default-external-format* :iso8859-1)
-	 (set-system-external-format :iso8859-1 nil))
+	 (set-system-external-format :iso8859-1))
 	((string-equal "/" lang :end2 (min 1 length))
 	 ;; Also, we don't handle the case where the locale starts
 	 ;; with a slash which means a pathname to a file created by
-	 ;; the localdef utility.  So use our defaults for that case
+	 ;; the localedef utility.  So use our defaults for that case
 	 ;; as well.
 	 (setf *default-external-format* :iso8859-1)
-	 (set-system-external-format :iso8859-1 nil))
+	 (set-system-external-format :iso8859-1))
 	(t
 	 ;; Simple parsing of LANG.  We assume it looks like
 	 ;; "language[_territory][.codeset]".  We're only interested
@@ -184,13 +185,14 @@
 		    (format (intern codeset "KEYWORD")))
 	       (cond ((stream::find-external-format format nil)
 		      (unless quiet
-			(write-string "Default external format and filename encoding: ")
+			(write-string "Default external format and terminal encoding: ")
 			(princ format)
 			(terpri))
 		      (setf *default-external-format* format)
-		      (set-system-external-format format format))
+		      (set-system-external-format format))
 		     (t
-		      (warn "Unknown or unsupported external format: ~S" codeset)))))))))))
+		      (warn "Unknown or unsupported external format: ~S; encodings unchanged"
+			    codeset)))))))))))
 
 (defun save-lisp (core-file-name &key
 				 (purify t)



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/0c3c5d94976d97f4f61b1b1aef2484ab02adc8bd

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/0c3c5d94976d97f4f61b1b1aef2484ab02adc8bd
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/20221007/0c4dfeb6/attachment-0001.html>


More information about the cmucl-cvs mailing list