Skip to main content
heyo
Associate III
July 18, 2023
Question

Unicodechar to char

  • July 18, 2023
  • 2 replies
  • 2480 views

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
August 2, 2023

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
August 2, 2023

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.