Ignore:
Timestamp:
Mar 9, 2012, 1:49:25 AM (8 years ago)
Author:
gb
Message:

Change the initial-values *TERMINAL-CHARACTER-ENCODING-NAME* and
*DEFAULT-FILE-CHARACTER-ENCODING* to :UTF-8, mostly for the benefit of
the Init-File-Editing-Impaired. (I've resolved not to make fun of
the IFEI.) Note that this may require changes to startup scripts etc.

Define new conditions CCL:DECODING-PROBLEM and CCL:ENCODING-PROBLEM.
Signal these conditions (via SIGNAL) when decoding characters
from/enoding them to a stream, pointer or octet vector and a substitution
or replacement character would be used.

New macros (CCL:WITH-DECODING-PROBLEMS-AS-ERRORS &body body) and
(CCL:WITH-ENCODING-PROBLEMS-AS-ERRORS &body body) signal the corresponding
conditions as ERRORs if they are signaled during execution of the body.

(Arguably) fixes ticket:749.

FILE-STRING-LENGTH checks to see if the encoding wants to use a
byte-order-mark before subtracting the length of an encoded BOM
from the encoded string length if the file is at its beginning.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-1/l1-sysio.lisp

    r15165 r15236  
    8585(defvar *default-external-format* :unix)
    8686
    87 (defvar *default-file-character-encoding* nil)
     87(defvar *default-file-character-encoding* :utf-8)
    8888
    8989(defmethod default-character-encoding ((domain (eql :file)))
     
    932932                   (file-string-length stream #\Return))
    933933                0))
    934            (if (eql (file-position stream) 0)
    935              0
    936              (length (character-encoding-bom-encoding encoding)))))))))
     934           (if (and (eql (file-position stream) 0)
     935                    (character-encoding-use-byte-order-mark encoding))
     936             (length (character-encoding-bom-encoding encoding))
     937             0)))))))
    937938 
Note: See TracChangeset for help on using the changeset viewer.