file encoding switch

file encoding switch

Purpose

File encoding switch

API Parameter Name Name prior to V12.6.0
C CPXPARAM_Read_FileEncoding CPX_PARAM_FILEENCODING
C++ IloCplex::Param::Read::FileEncoding FileEncoding (string)
Java IloCplex.Param.Read.FileEncoding FileEncoding (string)
.NET Cplex.Param.Read.FileEncoding FileEncoding (string)
OPL not available not available
Python parameters.read.fileencoding read.fileencoding
Interactive read fileencoding read fileencoding
Identifier 1129 1129

Description

Specifies which encoding (also known as the code page) that CPLEX uses for reading and writing files. This parameter accepts a string, such as UTF-8, ISO-8859-1, US-ASCII, and so forth, specifying the user’s choice of encoding for reading and writing files.
Note:

This parameter has no effect on IBM CPLEX Optimizer for z/OS, where only EBCDIC IBM-1047 encoding is available.

The default value of this parameter depends on the CPLEX component.

  • In the Python API, the default value of the file encoding parameter is the empty string (" ") for consistency with Python conventions.

  • In other APIs of CPLEX, such as the C, C++, Java, .NET API, the default value of the file encoding parameter is the string ISO-8859-1 (also known as Latin-1).

The encoding ISO-8859-1 is a superset of the familiar ASCII encoding, so it supports many widely used character sets. However, this default encoding cannot represent multi-byte character sets, such as Chinese, Japanese, or Korean characters, for example. If you want CPLEX to represent a character set that requires multiple bytes per character, then a better choice for the value of this parameter is UTF-8. The encoding UTF-8 is compatible with ASCII encoding; it represents every character in Unicode; it does not include a NULL byte in a valid character; it does not require specification of big-end or little-end byte order; it does not require a byte-order mark.

When you change the value of this parameter, you also need to verify that the API string encoding switch (CPX_PARAM_APIENCODING, APIEncoding) is compatible. The encoding specified by the API encoding parameter must be a subset of the encoding specified by the file encoding parameter. For example, if the API encoding parameter specifies US-ASCII, then UTF-8 is a reasonable choice for the file encoding parameter because the code page US-ASCII is a subset of UTF-8.

For a complete list of valid strings that are the name of an encoding (that is, the name of a code page), consult the web site of a standards organization such as:

In situations where CPLEX encounters a string, such as content in a file, that is not compatible with the specified encoding, the behavior is not defined. Because of the incompatibility, CPLEX silently converts the string to an inappropriate character of the specified encoding, or CPLEX raises the error 1235 CPXERR_ENCODING_CONVERSION.

Values

valid string for the name of an encoding (code page); default: ISO-8859-1 or the empty string (“ “)

See also

API string encoding switch