TextEncodingConverterGetCodePage(String, Int32) Method
Examines a text file, to see if it starts with a Byte Order Mark (BOM), and
returns an appropriate code page. (The fallback value is 65001 for UTF-8.)
Namespace: FolkerKinzel.StringsAssembly: FolkerKinzel.Strings (in FolkerKinzel.Strings.dll) Version: 9.4.0+10a7d4d71aa960998e32ac0ac6c4fcbe4164c917
public static int GetCodePage(
string filePath,
out int bomLength
)
Public Shared Function GetCodePage (
filePath As String,
<OutAttribute> ByRef bomLength As Integer
) As Integer
public:
static int GetCodePage(
String^ filePath,
[OutAttribute] int% bomLength
)
static member GetCodePage :
filePath : string *
bomLength : int byref -> int
- filePath String
- Path to the file to examine.
- bomLength Int32
- When the method returns, it contains the length of the BOM
found or zero if no BOM was found. The parameter is passed uninitialized.
Int32An appropriate code page for the text file or the code page for
UTF-8 (65001) if the code page could not be determined from the byte order mark.
The method recognizes the byte order marks for the following character sets:
-
UTF-8
-
UTF-16LE
-
UTF-16BE
-
UTF-32LE
-
UTF-32BE
-
UTF-7
-
GB18030
UTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE can also be recognized by the method from
the data if there is no Byte Order Mark.