Determines the text encoding used in a file.
FileGetEncoding ( "filehandle/filename" [, mode] )
| filehandle/filename | The handle of a file, as returned by a previous call to FileOpen. Alternatively you may use a string filename as the first parameter. |
| mode | [optional] The UTF8 detection mode to use. 1 = Check entire file for UTF8 sequences (default) 2 = Check first part of file for UTF8 sequences (the same as FileOpen uses by default) |
| Success: | Returns the file encoding using similar values to the FileOpen function: |
| 0 = ANSI | |
| 32 = UTF16 Little Endian. | |
| 64 = UTF16 Big Endian. | |
| 128 = UTF8 (with BOM). | |
| 256 = (without BOM). | |
| Failure: | Returns -1. |
Local $iEncoding = FileGetEncoding(@ScriptFullPath) ; Retrieve the file encoding of the running script.
If @error Then
MsgBox(4096, "Error", "Could not obtain the file encoding.")
Else
MsgBox(4096, "FileGetEncoding", "The value returned was: " & $iEncoding) ; The value returned for this example should be 0 or ANSI.
EndIf