NextPrevUpTopContentsIndex

detect-unicode-bom

Function
Summary

Looks for the Unicode Byte Order Mark, which if found is assumed to indicate a Unicode UCS-2 encoded file.

Package

system

Signature

detect-unicode-bom 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

A new external format spec created by merging ef-spec with the encoding that was found.

Description

When called as part of open's encoding detection routine, if byte pair FE FF is found at the start of the file, it is assumed to be UTF16-BE encoded. This encoding is represented by the ef-spec (:unicode :little-endian nil) .

If byte pair FF FE is found at the start of the file, it is assumed to be UTF16-LE encoded. This encoding is represented by the ef-spec (:unicode :little-endian t) .

See also

*file-encoding-detection-algorithm*


LispWorks Reference Manual - 12 Mar 2008

NextPrevUpTopContentsIndex