DecodeRune (FUN)

FUNCTION DecodeRune : RUNE

Unpacks the first UTF-8 encoding in pbyData and returns the rune and its length in bytes.

If pbyData is empty it returns (c_diRuneError, udiLength=0). Otherwise, if the encoding is invalid, it returns (c_diRuneError, udiLength=1`). Both are impossible results for correct, non-empty UTF-8.

An encoding is invalid if it is incorrect UTF-8, encodes a rune that is out of range, or is not the shortest possible UTF-8 encoding for the value. No other validation is performed.

InOut:

Scope

Name

Type

Return

DecodeRune

RUNE

Input

pbyData

POINTER TO BYTE

udiSize

UDINT

Output

udiLength

UDINT