Skip to content

Utf8ToOem

See Also: OemToUtf8, String Functions

Purpose

Converts a string to the OEM character format.

Return Type

String

Syntax

Use CharTranslate.pkg
(Utf8ToOem({stringValue}))

Where:

  • {stringValue} is a string.

What It Does

DataFlex strings are by default encoded as UTF-8. When working with external APIs or exporting data, it is sometimes necessary to convert strings to OEM.

Note that this should be used with caution, as most string functions will not function properly on OEM strings.

Additionally, the debugger will not be able to display OEM strings correctly, as it expects UTF-8. Converting from UTF-8 to OEM is a lossy conversion, which means that not all characters can be represented in the limited OEM set and will be replaced by the ? character.

Examples

Procedure Test
    String sValue sOemString
    // Move a value to string sValue
    Move (Utf8ToOem(sValue)) to sOemString
End_Procedure