Chooses an encoding from a list of specific encodings, if one is valid.
system
specific-valid-file-encoding pathname ef-spec buffer length => new-ef-spec
pathname⇩ |
Pathname identifying location of buffer. |
ef-spec⇩ |
An external format spec. |
buffer⇩ |
A buffer whose contents are examined. |
length⇩ |
Length (an integer) up to which buffer should be examined. |
new-ef-spec |
Default external format spec created by merging ef-spec with the encoding that was found to be valid. |
The function specific-valid-file-encoding
tests each element of *specific-valid-file-encodings* to see if it is valid for the contents of buffer, bounded by length. The first valid encoding is returned. For input files, buffer will contain the start of the file, so it is assumed that it contains a representative sample. For output files, buffer will have length 0, so the first element of *specific-valid-file-encodings* will always be returned.
specific-valid-file-encoding
is a member of the default value of *file-encoding-detection-algorithm*.
You need to set *specific-valid-file-encodings* for specific-valid-file-encoding
to have any effect. The default value of *specific-valid-file-encodings* is nil
, which causes specific-valid-file-encoding
to return ef-spec unchanged.
*specific-valid-file-encodings*
*file-encoding-detection-algorithm*
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02