Extensions.StringUtil.Encoding

From emotive
Jump to navigation Jump to search

Classification

Name Encoding
Short Description Describing different kinds of string encodings
Class Simple Data Type
Base Data Type SimpleType
Default Value US-ASCII
Provide a Literal Yes
SpecifiedBy ISO 13209-3
Standard Compliant Yes

Description

Encoding is an enumeration type describing different kinds of string encodings which will be supported by OTX applications.

The list of allowed enumeration values is defined as follows:

Value Literal Description
US-ASCII @Encoding:US-ASCII String encoding specified by [ISO/IEC 646]
ISO-8859-1 @Encoding:ISO-8859-1 String encoding specified by [ISO/IEC 8859-1]
UTF-8 @Encoding:UTF-8 String encoding from the UTF encoding family, see [ISO/IEC 10646]
UTF-16BE @Encoding:UTF-16BE String encoding from the UTF encoding family, see [ISO/IEC 10646]
UTF-16LE @Encoding:UTF-16LE String encoding from the UTF encoding family, see [ISO/IEC 10646]
UTF-16 @Encoding:UTF-16 String encoding from the UTF encoding family, see [ISO/IEC 10646]
BIN @Encoding:BIN Simple radix-based string encoding for binary-dump strings
OCT @Encoding:OCT Simple radix-based string encoding for octal-dump strings
HEX @Encoding:HEX Simple radix-based string encodingfor hexadecimal-dump strings

Order Relation

Encoding values may occur as operands of comparisons. For this case, the following order relation is defined. Started with the lowest value US-ASCII = 0:

US-ASCII < ISO-8859-1 < UTF-8 < UTF-16BE < UTF-16LE < UTF-16 < BIN < OCT < HEX

Literal

The syntax for Literals for complex data types will be used, where the member value is one of the values in the list.

@Encoding:US-ASCII|ISO-8859-1|UTF-8|UTF-16BE|UTF-16LE|UTF-16|BIN|OCT|HEX

Core Conversion

The following table shows the rules for conversion to another data type:

Conversion Result Sample
ToBoolean Undefined (should not be used)
ToInteger Returns the index of the value in the Encodings enumeration (smallest index is 0) Integer val = ToInteger(@Encoding:US-ASCII); // Returns 0
ToFloat Undefined (should not be used)
ToString Returns the name of the enumeration value String s = ToString(@Encoding:US-ASCII); // Returns "US-ASCII"
ToByteField Undefined (should not be used)

Sample

StringUtil.Encoding EncodingVariable = @Encoding:US-ASCII;