How to transform an array of char into UTF-8?

1

For example, I have a char cadeia[300]; . I put characters in it, now I want to turn it into UTF-8.

    
asked by anonymous 30.08.2015 / 00:59

1 answer

1

I know you do not want this answer but do not even try to do this.

Strings with any multibyte encoding are difficult to manipulate. Unless you really want to venture into something very laborious, get a library ready to manipulate this kind of data. You can use the ICU , you can use the wstring if your compiler supports it.

So if you use this, and need strings without being UTF-8, use string .

If you use these types, you do not need to use char * or char[] . We strongly recommend doing this.

If you really have a legacy code that uses char * , you can create a string wide like this:

wstring wcadeia(cadeia);
    
30.08.2015 / 02:01