Skip to main content
heyo
Associate III
Jul 18, 2023 5:55 AM UTC
Question

Unicodechar to char

How to change type from Unicodechar to char? I'm trying to pass char to model like this, but it only passes one character. What I am doing wrong?

heyo_0-1689660758663.png

 

 

This topic has been closed for replies.

2 replies

ST Employee
Aug 2, 2023 12:31 PM UTC

Hello @heyo,

Based on the amount of information you have provided it's a bit difficult to judge, however, there are some functions that you can use to convert Unicode to char. For instance, you can use the wcstombs() function from the <cstdlib> header to convert a wide character string to a multibyte character string. Or using wstring_convert class from the <locale> header.

Hope this would help you.

Mohammad MORADIST Software Developer | TouchGFX
Senior II
Aug 2, 2023 1:26 PM UTC

As you have created this question in the TouchGFX forum, I assume you are using TouchGFX. Then you can use the function

 

Unicode::toUTF8(unicode, utf8, maxbytes)

 

provided by Unicode.hpp.

When this account seems to be inactive, try &#64;tdecker2 - ST can't change mail addresses, so I had to create a new account.