Hitachi

JP1 Version 12 JP1/Automatic Operation Service Template Reference


4.13.25 Converting the character encoding of a file

Function

This plug-in converts the character encoding of a text file. The character encodings to be used before and after conversion are specified separately.

The path of the target file is specified by the common.targetFilePath property. The value of this property cannot include wildcard characters.

The plug-in reads the target file by using the character encoding specified by the common.characterEncodingFrom property. Next, the plug-in converts the character encoding to the encoding specified by the common.characterEncodingTo property, and then outputs the results to the file in the path specified by the common.outputFilePath property.

If no folder exists at the output destination path (common.outputFilePath property), a folder is created.

If a file already exists in the output destination path, the plug-in terminates abnormally.

The character encodings that can be specified are JIS, SJIS, EUC-JP, and UTF-8. If a character encoding other than one of these encodings is specified, the plug-in terminates abnormally. If UTF-8 is specified for the common.characterEncodingTo property (character encoding after conversion), the plug-in outputs the results to a text file without BOM.

Use situation

When files are moved between OSs, this plug-in can be used to convert the character encoding of the files to one that can be used on the destination OS.

Prerequisites

For the most recent information about the prerequisite products in the system, the prerequisite products on the execution-target server, and the supported OSs on the execution-target server, see the Release Notes.

[Prerequisite products in the system]

JP1/Automatic Operation 11-00 or later

[Prerequisite products on the execution-target server]

None.

[Supported OSs on the execution-target server]

(1) Windows Server 2008 R2 Standard/Enterprise/Datacenter

(2) Windows Server 2012 Standard/Datacenter or Windows Server 2012 R2 Standard/Datacenter

(3) Windows Server 2016 Standard/Datacenter

(4) Windows Server 2019 Standard/Datacenter

(5) Red Hat Enterprise Linux Server 6 (32-bit x86) or Red Hat Enterprise Linux Server 6 (64-bit x86_64)

(6) Red Hat Enterprise Linux Server 7 (64-bit x86_64)

(7) Red Hat Enterprise Linux Server 8 (64-bit x86_64)

(8) CentOS 6 (64-bit x86_64)

(9) CentOS 7 (64-bit x86_64)

(10) CentOS 8 (64-bit x86_64)

(11) Oracle Linux 8 (64-bit x86_64)

[Conditions for using the execution-target server]

None.

Cautions

(1) For the properties of this plug-in, do not specify any strings that include double quotation marks (") or single quotation marks (').

(2) Depending on the type of character encoding to be converted, the character encoding might vary between OSs. As a result, such character encodings might not be converted correctly.

(3) If the OS of the execution-target server is UNIX, do not convert UTF-8 text files with BOM. If you convert such a file, the plug-in might terminate abnormally, or the text in the file might become corrupted.

(4) If the OS of the execution-target server is Windows and you attempt to convert an empty file, an empty file will be created at the destination path (specified in the common.outputFilePath property). If the OS of the execution-target server is UNIX and you attempt to convert an empty file, no file will be created.

(5) When specifying the conversion-target string, make sure it does not include platform-dependent characters or characters outside the range of the character encoding. If such characters are included, the plug-in might terminate abnormally or the text in the converted file might become corrupted.

(6) When specifying the path of the conversion-target file for the common.targetFilePath property, the conversion-source character encoding specified for the common.characterEncodingFrom property must be the same as the character encoding of the target file. If you specify a different character encoding, the plug-in might terminate abnormally or the text in the converted file might become corrupted.

Version

02.00.00

Plug-in tags

Control OS,Windows,Linux

Plug-in name displayed in the task log

osConvertFileCharacterEncoding

Return code

0: Normal

12: Error (Mistake by user) Invalid property

27: Error (Check with the task log about the error detail) Unidentified error

41: Error (An error has been detected in the plug-in) Property not entered (An error has been detected in the component script)

Property list

The following table lists the properties:

Property key

Property name

Description

Default value

I/O type

Required

plugin.destinationHost

Host name of the execution target server

Specify the host name or IP address of the server on which this plugin will be executed. IPv6 addresses are not supported.

--

Input

R

common.targetFilePath

Target file path

Enter the full path of the target file.

--

Input

R

common.characterEncodingFrom

Character encoding type (before conversion)

Specify "JIS", "SJIS", "EUC-JP", or "UTF-8" as the character encoding type for the file to be converted.

--

Input

R

common.characterEncodingTo

Character encoding type (after conversion)

Specify "JIS", "SJIS", "EUC-JP", or "UTF-8" as the character encoding type for the file after the conversion.

--

Input

R

common.outputFilePath

Output file path

Specifies the file to be output as a full path.

--

Input

R

common.returnValue

Return value for the plugin

The return value of this plugin stored.

--

Output

--