Online Help
This is a action plugin that allows you to perform conversions between different character encodings.
These are the encodings that are accepted as fromEncoding and toEncoding in the actions:
asmo-708 big5 cp866 cp875 dos-720 dos-862 euc-jp euc-kr gb2312 ibm00858 |
ibm037 ibm437 ibm500 ibm737 ibm775 ibm850 ibm852 ibm855 ibm857 ibm860 |
ibm861 ibm863 ibm864 ibm865 ibm869 ibm870 iso-2022-jp iso-2022-kr iso-8859-1 iso-8859-2 |
iso-8859-3 iso-8859-4 iso-8859-5 iso-8859-6 iso-8859-7 iso-8859-8 iso-8859-9 iso-8859-13 iso-8859-15 koi8-r |
koi8-u ks_c_5601-1987 macintosh shift_jis unicode unicodefffe us-ascii utf-7 utf-8 utf-32 |
utf-32be windows-874 windows-1250 windows-1251 windows-1252 windows-1253 windows-1254 windows-1255 windows-1256 windows-1257 |
windows-1258 x-mac-arabic x-mac-ce x-mac-chinesesimp x-mac-chinesetrad x-mac-croatian x-mac-cyrillic x-mac-greek x-mac-hebrew x-mac-icelandic |
x-mac-japanese x-mac-korean x-mac-romanian x-mac-thai x-mac-turkish x-mac-ukrainian |
Reads the contents of a text file in one encoding and saves it using different encoding.
(string) The full path to the input text file.
(string) The encoding of the source file to be read.
(string) The full path to the output text file.
(string) The encoding of the destination text file.
Nothing. You can use Application.GetLastError to determine whether this action failed, and why.
Converts a string from one encoding to another string with different encoding.
(string) The full path to the input text file.
(string) The encoding of the source file to be read.
(string) The encoding of the destination text file.
(string) The converted string in the new character encoding. You can use Application.GetLastError to determine whether this action failed, and why.
Reads the contents of a text file in a certain encoding and returns it as a table in a different encoding.
(string) The full path to the text file.
(string) The encoding of the source file to be read.
(string) The optional encoding of the converted text in the table. The default is "iso-8859-1" (ANSI Latin-1).
(table) The converted text file as table. You can use Application.GetLastError to determine whether this action failed, and why.
-- read a text file in Unicode encoding
strFile = _TempFolder .. "\\TextFile.txt";
myTable = Encoding.ReadToTable(strFile, "unicode", "windows-1251");
error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Error", "Got error code " .. error .. " while converting from Unicode", MB_OK, MB_ICONEXCLAMATION);
else
-- now read each line in the table
for i, text in myTable do
Dialog.Message("info", "line " .. i .. " contains: " .. text, MB_OK);
end
end
Reads the contents of a text file in one encoding and returns it as a string in a different encoding.
(string) The full path to the text file.
(string) The encoding of the source file to be read.
(string) The optional encoding of the converted text in the string. The default is "iso-8859-1" (ANSI Latin-1).
(string) The converted text file as string. You can use Application.GetLastError to determine whether this action failed, and why.
-- read a XML file in UTF-8 encoding
strXMLPath = _TempFolder .. "\\utf8File.xml";
convertedXml = Encoding.ReadToString(strXMLPath, "utf-8");
error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Error", "Got error code " .. error .. " while converting from UTF-8", MB_OK, MB_ICONEXCLAMATION);
else
-- everything ok, proceed with XML processing...
XML.SetXML(convertedXml);
end
Writes a table's contents out to a text file. The table should consist of one line of text per table item.
(string) The full path to the text file.
(table) The lines of text to write.
(string) The encoding of the file to be written.
(string) The optional encoding of the text in the table. If omitted, "iso-8859-1" (ANSI Latin-1) is assumed.
(nothing) You can use Application.GetLastError to determine whether this action failed, and why.
-- save a table as text file with UTF-8 encoding
Encoding.WriteFromTable(_TempFolder .. "\\utf8File.txt", myTable, "utf-8");
if (error ~= 0) then
Dialog.Message("Error", "Got error code " .. error .. " while converting to UTF-8", MB_OK, MB_ICONEXCLAMATION);
end
Writes a string of text to a new file in a specific character encoding.
(string) The full path to the text file.
(string) The string of text to write.
(string) The encoding of the file to be written. Allowed options are: "iso-8859-1", "utf-8" and "unicode".
(string) The optional encoding of the text stored in the string. If omitted, "iso-8859-1" (ANSI Latin-1) is assumed.
(nothing) You can use Application.GetLastError to determine whether this action failed, and why.
-- save a string with Russian text as a file in Unicode encoding
Encoding.WriteFromString(_TempFolder .. "\\unicodeFile.txt", myString, "unicode", "windows-1251");
if (error ~= 0) then
Dialog.Message("Error", "Got error code " .. error .. " while converting to Unicode", MB_OK, MB_ICONEXCLAMATION);
end
12030 - Failed to start Encoding Actions plugin.
12031 - Conversion failed.
12032 - File not found.
12033 - Could not save file.
12034 - Internal error.
Ulrich Peters
upeters@mindquake.com.br
Plugin is copyright © 2009 MindQuake Serviços de Informática Ltda.
Copyright © 2009-2011 MindQuake Serviços de Informática Ltda.
Todos os direitos reservados.