Hello Gianluca,
the function to encode a UTF8 string from XString is actually not available. However, this enhancement is already waiting on our to-do list. For the moment you will need to implement the function by yourself. The following dummy code could help you (based on the description found here):
XChar* src = <EmWi String> unsigned char* dst = <buffer to store the encoded URF8> for ( ; src && *src; src++ ) { XChar c = *src; if ( *src <= 0x007F ) *dst++ = (unsigned char)c; else if ( *src <= 0x07FF ) { *dst++ = (unsigned char)( c >> 6 ) | 0xA0; *dst++ = (unsigned char)( c & 0x3F ) | 0x80; } else if ( *src <= 0xFFFF ) { *dst++ = (unsigned char)( c >> 12 ) | 0xE0; *dst++ = (unsigned char)(( c >> 6 ) & 0x3F ) | 0x80; *dst++ = (unsigned char)( c & 0x3F ) | 0x80; } }
Best regards
Paul Banach
Ask Embedded Wizard
Welcome to the question and answer site for Embedded Wizard users and UI developers.
Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!
Embedded Wizard Website | Privacy Policy | Imprint