encoding

Specifies an encoding to use when reading a file in a relevance expression. The encoding could be any name that the International Components for Unicode (ICU) can recognize, such as "ISO-8859-1", "Shift_JIS", and "UTF-8". Once created, the file objects can be used as regular file objects and you can apply any operation applicable to text files. If no encoding is specified, the files are read in the local encoding.

These are some examples:

  • Q: (content of file "c:\aaa\bbb.txt" of encoding "Shift_JIS") contains "うみ"

returns if the word "うみ" is found in the file "c:\aaa\bbb.txt" that is written in Shift_JIS.

  • Q: line 3 of file "eee.txt" of folder "/ccc/ddd" of encoding "Windows-1252"

returns the third line of the file "/ccc/ddd/eee.log" in Windows-1252.

  • Q: lines of file "/fff/ggg.txt" of encoding "UTF-8"

returns the lines of the file "/fff/ggg.txt" in UTF-8.

  • Q: lines of file "/hhh/iii.txt" of encoding "ISO-8859-1"

returns the lines of the file "/hhh/iii.txt" in ISO-8859-1.

  • Q: key "やま" of section "其之弐" of file "f:\ggg\hhh.ini" of encoding "UTF-8"

returns the value of the "やま" key in the "其之弐" section of the file "f:\ggg\hhh.ini" that is written in UTF-8.

Note: If the file starts with a BOM character that is not expected by the specified encoding, the line file inspector fails with U_INVALID_CHAR_FOUND.

Version Platforms
9.5.5.193 AIX, Debian, Mac, Red Hat, SUSE, Solaris, Ubuntu, Windows
9.5.13.130 Raspbian

Creation

encoding <string> : encoding

Properties

download file <string> of <encoding> : file
download folder of <encoding> : folder
file <binary_string> of <encoding> : file
file <string> of <encoding> : file
folder <binary_string> of <encoding> : folder
folder <string> of <encoding> : folder
hfs file <string> of <encoding> : file
hfs folder <string> of <encoding> : folder
native file <string> of <encoding> : file
native folder <string> of <encoding> : folder
posix file <string> of <encoding> : file
posix folder <string> of <encoding> : folder
x32 file <string> of <encoding> : file
x32 folder <string> of <encoding> : folder
x64 file <string> of <encoding> : file
x64 folder <string> of <encoding> : folder