All Manuals > LispWorks® User Guide and Reference Manual > 47 The SYSTEM Package

specific-valid-file-encoding Function

Summary

Chooses an encoding from a list of specific encodings, if one is valid.

Package

system

Signature

specific-valid-file-encoding pathname ef-spec buffer length => new-ef-spec

Arguments
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.
Values
new-ef-spec
Default external format spec created by merging ef-spec with the encoding that was found to be valid.
Description

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.

pathname is ignored.

specific-valid-file-encoding is a member of the default value of *file-encoding-detection-algorithm*.

Notes

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.

See also

*specific-valid-file-encodings*
*file-encoding-detection-algorithm*


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02