Raymond Toy pushed to branch issue-139-set-terminal-to-utf8 at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/code/save.lisp
    ... ... @@ -145,26 +145,22 @@
    145 145
     (defun set-up-locale-external-format ()
    
    146 146
       "Add external format alias for :locale to the format specified by
    
    147 147
       the locale as set by setlocale(3C)."
    
    148
    -  (let ((codeset (unix::unix-get-locale-codeset)))
    
    148
    +  (let ((codeset (unix::unix-get-locale-codeset))
    
    149
    +	(external-format nil))
    
    149 150
         (cond ((zerop (length codeset))
    
    150
    -	   ;; Codeset was the empty string, so just set :locale to
    
    151
    -	   ;; alias to the default external format.  
    
    151
    +	   (setq external-format *default-external-format*))
    
    152
    +	  (t
    
    153
    +	   (let ((name (intern codeset "KEYWORD")))
    
    154
    +             (setq external-format (stream::find-external-format name nil)))))
    
    155
    +    (cond (external-format
    
    152 156
     	   (setf (gethash :locale stream::*external-format-aliases*)
    
    153
    -		 *default-external-format*))
    
    157
    +		 external-format))
    
    154 158
     	  (t
    
    155
    -	     ;; If we know the format.  This could be an alias to
    
    156
    -	     ;; another format and so on, so use FIND-EXTERNAL-FORMAT
    
    157
    -	     ;; to determine the final format and use that as the
    
    158
    -	     ;; alias.
    
    159
    -	   (let* ((codeset-format (intern codeset "KEYWORD"))
    
    160
    -		  (final-format (stream::find-external-format codeset-format)))
    
    161
    -	     (setf (gethash :locale stream::*external-format-aliases*)
    
    162
    -		   (if final-format
    
    163
    -		       (stream::ef-name final-format)
    
    164
    -		       (progn
    
    165
    -			 (warn "Unsupported external format; using :iso8859-1 instead: ~S"
    
    166
    -			       codeset-format)
    
    167
    -			 :iso8859-1)))))))
    
    159
    +	   (warn "No external format found for codeset \"~S\"; using ~S instead"
    
    160
    +		 codeset
    
    161
    +		 *default-external-format*)
    
    162
    +	   (setf (gethash :locale stream::*external-format-aliases*)
    
    163
    +		 *default-external-format*))))
    
    168 164
       (values))
    
    169 165
     
    
    170 166