1
For example, I have a char cadeia[300];
. I put characters in it, now I want to turn it 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.
1
Don’t even try this.
Strings with any encoding multibyte are hard to manipulate. Unless you really want to venture into something very laborious, grab a library ready to manipulate this type of data. You can use the ICU, can use the type wstring
if your compiler supports.
So if you use this, and you need to strings without being UTF-8, use the type string
.
If you use these guys, you don’t have to use char *
or char[]
. We highly recommend doing this.
If you really have a legacy code that uses char *
, can create a string wide thus:
wstring wcadeia(cadeia);
Depending on the platform, iconv is a way to convert between different encodings in C
Browser other questions tagged array c++ string utf-8
You are not signed in. Login or sign up in order to post.
Take a look at this link http://stackoverflow.com/questions/2573834/c-convert-string-or-char-to-wstring-or-wchar-t
– krispim
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero