DIAdem API Reference

Command: TextFileEncoding

  • Updated2023-02-21
  • 2 minute(s) read

Display all  Hide all

Specifies the character encoding of a file. The function uses the Byte Order Mark (BOM) of the file to specify the character encoding.

ReturnValue = TextFileEncoding(FileName)

Input Parameters

FileName Specifies the filename.

Return Parameters

ReturnValue The return value is an Integer variable type. Contains the character encoding
4 eTextFileAttributeANSI Encoded in ANSI.
8 eTextFileAttributeUnicode Encoded in Unicode.
16 eTextFileAttributeUTF8 Encoded in UTF8.

Examples

The following example specifies the character encoding of a file:

VBScriptPython

 

Dim intMyEncode
intMyEncode = TextFileEncoding(ScriptReadPath & "NewText.txt")
Select Case intMyEncode
Case eTextFileAttributeANSI
  Call MsgBoxDisp("ANSI")
Case eTextFileAttributeUnicode
  Call MsgBoxDisp("Unicode")
Case eTextFileAttributeUTF8
  Call MsgBoxDisp("UTF8")
Case Else
  Call MsgBoxDisp("Error occured")
End Select

Related Functions

Command: TextFileEOL | Function: FR | Function: TextFileEOF | Function: TextFileError | Function: TextFileErrorTxt | Function: TextFileSeek