Intel® Fortran Compiler 17.0 Developer Guide and Reference

MBConvertMBToUnicode (W*S)

NLS Function: Converts a multibyte-character string from the current codepage to a Unicode string.

Module

USE IFNLS

result = MBConvertMBToUnicode (mbstr,unicodestr[,flags])

mbstr

(Input) Character*(*). Multibyte codepage string to be converted.

unicodestr

(Output) INTEGER(2). Array of integers that is the translation of the input string into Unicode.

flags

(Input; optional) INTEGER(4). If specified, modifies the string conversion. If flags is omitted, the value NLS$Precomposed is used. Available values (defined in IFNLS.F90) are:

  • NLS$Precomposed - Use precomposed characters always. (default)

  • NLS$Composite - Use composite wide characters always.

  • NLS$UseGlyphChars - Use glyph characters instead of control characters.

  • NLS$ErrorOnInvalidChars - Returns -1 if an invalid input character is encountered.

The flags NLS$Precomposed and NLS$Composite are mutually exclusive. You can combine NLS$UseGlyphChars with either NLS$Precomposed or NLS$Composite using an inclusive OR (IOR or OR).

Results

The result type is INTEGER(4). If no error occurs, the result is the number of bytes written to unicodestr(bytes are counted, not characters), or the number of bytes required to hold the output string if unicodestr has zero size. If the unicodestr array is bigger than needed to hold the translation, the extra elements are set to space characters. If unicodestr has zero size, the function returns the number of bytes required to hold the translation and nothing is written to unicodestr.

If an error occurs, one of the following negative values is returned:

Note

By default, or if flags is set to NLS$Precomposed, the function MBConvertMBToUnicode attempts to translate the multibyte codepage string to a precomposed Unicode string. If a precomposed form does not exist, the function attempts to translate the codepage string to a composite form.

See Also