Skip to main content

Change Encoding

Allows changing of file encoding.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.

Input

  • File Path - Path of the file for which encoding needs to be changed.
  • Save Path - Path where the file with changed encoding will be saved.

Options

  • Open with Encoding - Choose the encoding format in which the file will be opened. Available formats are:

    • UTF-8
    • UTF-16
    • Windows 1250
    • ...
    • Macintosh
    • KOI8-R
  • Save with Encoding - Choose the encoding format in which the file will be saved. Available formats are:

    • UTF-8
    • UTF-16
    • Windows 1250
    • ...
    • Macintosh
    • KOI8-R

How It Works

The Change Encoding node performs file encoding conversion through the following steps:

  1. Opens the source file at the specified path in read-only mode
  2. Reads the file content using the selected "Open with Encoding" decoder
  3. Converts the content from the source encoding to an internal representation
  4. Creates a new file at the specified save path
  5. Writes the content using the selected "Save with Encoding" encoder
  6. Handles unsupported characters by replacing them during conversion

Requirements

  • Valid file path to the source file
  • Valid save path for the converted file (can be the same as source to overwrite)
  • Read permissions on the source file
  • Write permissions on the save path directory
  • Source file must exist and be readable

Error Handling

Error CodeDescription
Core.FileSystem.ChangeEncoding.ErrOnCreateNode configuration parsing failed
Core.FileSystem.ChangeEncoding.ErrOnMessageInput message parsing failed
Core.FileSystem.ChangeEncoding.ErrInPathFile path is empty
Core.FileSystem.ChangeEncoding.ErrInSavePathSave path is empty
Core.FileSystem.ChangeEncoding.ErrOpenFileCannot open source file (file not found or permission denied)
Core.FileSystem.ChangeEncoding.ErrCreateFileCannot create destination file (invalid path or permission denied)
Core.FileSystem.ChangeEncoding.ErrConvertEncodingEncoding conversion failed

Usage Examples

Example 1: Convert UTF-8 to Windows-1250

Convert a UTF-8 encoded text file to Windows-1250 encoding for legacy systems:

{
"filePath": "C:\\Documents\\report_utf8.txt",
"savePath": "C:\\Documents\\report_win1250.txt"
}

Configuration:

  • Open with Encoding: UTF-8
  • Save with Encoding: Windows 1250

Example 2: Convert Windows-1251 to UTF-8

Convert a Cyrillic text file from Windows-1251 to UTF-8 for modern applications:

{
"filePath": "D:\\Files\\document_cyrillic.txt",
"savePath": "D:\\Files\\document_utf8.txt"
}

Configuration:

  • Open with Encoding: Windows 1251
  • Save with Encoding: UTF-8

Example 3: In-Place Encoding Conversion

Convert a file's encoding by overwriting the original file:

{
"filePath": "C:\\Data\\legacy_file.txt",
"savePath": "C:\\Data\\legacy_file.txt"
}

Configuration:

  • Open with Encoding: ISO-8859-1
  • Save with Encoding: UTF-8

Usage Notes

  • The node supports a wide range of encodings including UTF-8, UTF-16, Windows (1250-1258), ISO-8859 (1-16), Macintosh, and KOI8-R
  • Unsupported characters in the target encoding are automatically replaced during conversion
  • If the source and destination paths are the same, the original file will be overwritten
  • UTF-8 is used as the default encoding if an invalid encoding is specified
  • The node preserves file content but does not preserve file metadata or permissions

Tips

  • Always backup important files before performing in-place encoding conversions
  • Test encoding conversion on a sample file first to ensure proper character mapping
  • Use UTF-8 as the target encoding for maximum compatibility with modern systems
  • When converting from single-byte encodings (like Windows-1250) to UTF-8, file sizes may increase
  • Verify the source file's actual encoding before conversion to avoid corrupted output
  • Some character sets may not have equivalent characters in the target encoding
  • Read File - Read file content before encoding conversion
  • Write File - Write encoded content to files
  • Copy File/Dir - Create a backup before encoding conversion