sLiteral_TO_UTF8

sLiteral_TO_UTF8 1:

This function converts any character string of the data type STRING into a character string in UTF-8 format. The function is particularly suitable for the assignment of literals.

When assigning literals to a UTF-8 STRING, the rules are:

An empty string will be returned if the literal is longer than the possible output character string.

FUNCTION sLiteral_TO_UTF8 : STRING(511)

VAR_INPUT

VAR_IN_OUT CONSTANT
    sLiteral   : STRING;
END_VAR

sLiteral: STRING character string to be converted.

Examples

{attribute 'TcEncoding' := 'UTF-8'}
sMyText : STRING := sLiteral_TO_UTF8('Hühner legen Eier.');
{attribute 'TcEncoding' := 'UTF-8'}
sMyText1 : STRING := sLiteral_TO_UTF8('The dinner costs 30 €.');
sLiteral_TO_UTF8 2:

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.34.0