STRING_TO_UTF8
The function converts any string of a variable of the data type STRING to a string in UTF-8 format.
The function returns
- TRUE if the conversion was possible.
- FALSE if the conversion was not possible due to the given character set.
If the input string is longer than the output string, the string will be truncated. The input string is too long to be coded to the output string. The memory requirement for the output string can be higher than that for the input string when converting to UTF-8.
The function stops the conversion to Tc2_Utilities.Parameterlist.cMaxCharacters
.
With appropriate parameterization an infinite loop can be avoided.
FUNCTION STRING_TO_UTF8 : BOOL
Inputs
VAR_INPUT
pDstUTF8 : PVOID;
pSrcSTRING : POINTER TO STRING;
nDstSize : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
pDstUTF8 | PVOID | Pointer to the string in UTF-8 format (output string) |
pSrcSTRING | POINTER TO STRING | Pointer to the STRING variable to be converted (input string) |
nDstSize | UDINT | Size of the resulting variable (output string) in bytes. The operator SIZEOF() can be used for the assignment. |
Documentation for attribute 'TcEncoding' := 'UTF-8' For more information about strings in UTF-8 format see also the documentation on the 'TcEncoding' attribute. |
Requirements
Development environment | Target platform | PLC libraries to be integrated (category group) |
---|---|---|
TwinCAT v3.1.4022 | PC or CX (x86, x64, ARM) | Tc2_Utilities (System) >= 3.3.21.0 |