EncodeRune2 (FUN) ¶ FUNCTION EncodeRune2 : UDINT Encodes a rune in memory segments, if it doesn’t fit in the first segment than the second segment is used. The rune has to be valid, otherwise nothing is returned. The function returns the number of written bytes as well as the offset of the second memory segment. InOut: Scope Name Type Comment Return EncodeRune2 UDINT Input diRune RUNE The rune to be encoded pbyData POINTER TO BYTE Pointer to the first byte of the first segment udiSize UDINT Size of the first segment in bytes pbyData2 POINTER TO BYTE Pointer to the first byte of the second segment udiSize2 UDINT Size of the second segment in bytes Output udiOffset UDINT Offset of the second segment needed bytes
IsFullRune (FUN) ¶ FUNCTION IsFullRune : BOOL Reports whether the bytes in pbyData begin with a full UTF-8 encoding of a rune. An invalid encoding is considered a full rune since it will convert as a error rune. InOut: Scope Name Type Comment Return IsFullRune BOOL Input pbyData POINTER TO BYTE Pointer to the first byte of the memory udiSize UDINT Size of the memory in bytes
IsRuneStart (FUN) ¶ FUNCTION IsRuneStart : BOOL Reports whether byData could be the first byte of an encoded, possibly invalid rune. Second and subsequent bytes always have the top two bits set to 2#10xxxxxx . InOut: Scope Name Type Comment Return IsRuneStart BOOL Input byData BYTE Input value to be analyzed
IsValid (FUN) ¶ FUNCTION IsValid : BOOL Reports whether pbyData consists entirely of valid UTF-8-encoded runes. InOut: Scope Name Type Comment Return IsValid BOOL Input pbyData POINTER TO BYTE Pointer to the first byte of the memory udiSize UDINT Size of the memory in bytes
IsValidRune (FUN) ¶ FUNCTION IsValidRune : BOOL Reports whether diRune can be legally encoded as UTF-8. Code points that are out of range or a surrogate half are illegal. InOut: Scope Name Type Comment Return IsValidRune BOOL Input diRune RUNE Rune to be analyzed
ReduceSegment (FUN) ¶ FUNCTION ReduceSegment : UDINT This fuction reduces a segment to get a segment with only complete utf8 runes in it. It returns the number of the necessary bytes for the utf8 runes. InOut: Scope Name Type Comment Return ReduceSegment UDINT Input pbyData POINTER TO BYTE Pointer to the first byte of segment udiSize UDINT Size of the segment in bytes
RuneCount (FUN) ¶ FUNCTION RuneCount : UDINT Returns the number of runes in pbyData . Erroneous and short encodings are treated as single runes of length 1 byte. InOut: Scope Name Type Comment Return RuneCount UDINT Input pbyData POINTER TO BYTE Pointer to the first byte in memory udiSize UDINT Memory size in byte
RuneLen (FUN) ¶ FUNCTION RuneLen : UDINT Returns the number of bytes required to encode the rune. It returns 0 if the rune is not a valid value to encode in UTF-8. InOut: Scope Name Type Comment Return RuneLen UDINT Input diRune RUNE The rune to be analyzed
Globals ¶ Constants (GVL)
Constants (GVL) ¶ InOut: Scope Name Type Initial Comment Constant c_diRuneError RUNE DINT#16#FFFD The “error” Rune or “Unicode replacement character” c_diMaxRune DINT DINT#16#10FFFF