SIMPOL Documentation

findfileencoding()

Description

This function attempts to detect if the string passed is Unicode and if so which encoding it uses. This supports using a byte order mark as well as not having one. It is meant to be used on the initial chunk of a file, and it is recommended to pass around 240 bytes or so if possible which should be read from the start of file using 1 byte per character.

[Note]Note

It is horribly difficult to determine encoding this way. It should only be used as a starting point for determining the encoding type. So if the return value is 1, it is not 100% sure that it is ANSI. Asking the user is always best.

Prototype

findfileencoding ( string s, boolean hasBOM )

Parameters

ParameterDefault valueType nameDescription
sNonestring
hasBOMNoneboolean