Xbasic
FILE.TEXT_ENCODING Function
Syntax
Encoding_Mode as C = file_pointer.text_encoding()
Returns
- Encoding_Mode
Possible return values include:
- "ASCII"
- "UTF8"
Unicode Transformation Format 8 bit (Multi-byte)
- "UTF16LE"
Unicode Transformation Format 16 bit Little-endian
- "UTF16BE"
Unicode Transformation Format 16 bit Big-endian
- "UTF32LE"
Unicode Transformation Format 32 bit Little-endian
- "UTF32BE"
Unicode Transformation Format 32 bit Big-endian
Description
Get the encoding type of a text file. Possible Values Include: (ASCII, UTF16LE, UTF16BE, UTF32LE, UTF32BE)
Discussion
The .TEXT_ENCODING() method returns the text encoding method of the data. When most people reference Unicode, they are referring to UTF16LE.
Example
h = FILE.open("c:\r_broken.bin", FILE_RO_SHARED)
? h.bytes_get()
= 38
? h.chars_get()
= 18
? h.read(19)
= x this is a test
? h.text_encoding()
= "UTF16LE"See Also