wsLiteral_TO_UTF8

wsLiteral_TO_UTF8 1:

This function converts any character string of the data type WSTRING 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 wsLiteral_TO_UTF8 : STRING(511)

wsLiteral_TO_UTF8 2: Inputs

VAR_IN_OUT CONSTANT
    wsLiteral   : WSTRING;
END_VAR

Name

Type

Description

wsLiteral

WSTRING

WSTRING to be converted.

Examples

{attribute 'TcEncoding' := 'UTF-8'}
sMyText : STRING := wsLiteral_TO_UTF8("Hühner legen Eier.");
{attribute 'TcEncoding' := 'UTF-8'}
sMyText2 : STRING := wsLiteral_TO_UTF8("The dinner costs 30 €.");
wsLiteral_TO_UTF8 3:

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