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

Commits:

1 changed file:

Changes:

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