LGF_EncodeUtf8 (FC / V1.0.0)

Overview

Author: Siemens Online Support

Short description

Encodes a WString into an UTF-8 encoded byte stream.

Block Interface

LGF_EncodeUtf8 (FC)
WString  sourceString Ret_Val  Word
    
DInt  startPos bytesUsed  UInt
    
Array[*] of Byte  encodedByteStream  Array[*] of Byte
       
   

Input parameter

IdentifierData type Description
sourceStringWString Character that shall be converted to UTF-8
startPosDInt Position in encoded byte stream to start insert encoded WChars (Array lower bound is added)

Output parameter

IdentifierData type Description
Ret_ValWord 16#0000 - 16#7FFF: Status of the FC, 16#8000 - 16#FFFF: Error identification
bytesUsedUInt Number of Bytes converted. Ranges from 1 to 3.

In/Out parameter

IdentifierData type Description
encodedByteStreamArray[*] of Byte UTF-8 conformant byte sequence. B0 stores first Byte, B1 second and B2 third Byte. B3 is not used

Status & Error codes

Code / ValueIdentifier / Description
16#0000STATUS_NO_ERROR
Status: No error
16#8201ERR_START_POS_OUTSIDE
Error: Parameter `startPos` is outside array bounds
16#8202ERR_COUNT_EXCEEDS_BOUNDS
Error: Lenght of array reached

Change log

Version & DateChange description
01.00.00Siemens Online Support
2022-12-16First released version