lundi 30 novembre 2020

Convert utf16 unsigned short to utf8 unsigned char

I have the following:

unsigned short *name = new unsigned short[name_size];
memcpy_s(name, name_size*2, &byteArray[offset], name_size*2);

The source is utf16-LE and I would like to work with UTF8 in an array of chars. Is there a library for the conversion? Or can someone guide me to find the algorithm to do it myself?

For now it is enough for me to delete the second byte, which is always 00 since most of the information is plain text, but I know that is not the way to do it.

Aucun commentaire:

Enregistrer un commentaire