###Function###
FileGetEncoding

###Description###
Determines the text encoding used in a file.

###Syntax###
FileGetEncoding ( "filehandle/filename" [, mode = 1] )


###Parameters###
@@ParamTable@@
filehandle/filename
	The handle of a file, as returned by a previous call to <a href="FileOpen.htm">FileOpen()</a>. 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 <a href="FileOpen.htm">FileOpen()</a> uses by default)
@@End@@

###ReturnValue###
@@ReturnTable@@
Success:	the file encoding using similar values to the <a href="FileOpen.htm">FileOpen()</a> function:
		0 = ANSI
		32 = UTF16 Little Endian.
		64 = UTF16 Big Endian.
		128 = UTF8 (with BOM).
		256 = (without BOM).
Failure:	-1.
@@End@@


###Remarks###
If a filename is given rather than a file handle - the file will be opened and closed during the function call.
Note: Do not mix filehandles and filenames, i.e., don't <a href="FileOpen.htm">FileOpen()</a> a file and then use a filename in this function.  Use either filehandles or filenames in your routines, not both!

If a file handle is used then the "mode" parameter has no effect - the mode used for <a href="FileOpen.htm">FileOpen()</a> takes precedence.


###Related###
FileOpen, FileRead, FileReadLine, FileWrite, FileWriteLine


###Example###
@@IncludeExample@@
