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

Comment

Return

DecodeRune

RUNE

Input

pbyData

POINTER TO BYTE

Pointer to the first byte in memory

udiSize

UDINT

Memory size in byte

Output

udiLength

UDINT

Lenght of the rune in bytes