UTF-8 string declaration

I understand that it's possible to declare a UTF-8 string like this:
 
char String[] = u8"testãingãã";

but how is it possible to assign an UTF-8 variable to another variable?
this is what i mean:
1
2
char Foo[] = u8Bar; // the other variable
//obviously not like this 

How is it done? What is the syntax?
The fact that the string is UTF-8 encoded doesn't really matter. The problem is that you can't assign arrays using the = operator. You can use std::strcpy to copy the string from one array to another but I recommend using std::string because that makes a lot of string operations much much easier.

1
2
std::string str1 = u8"testãingãã";
std::string str2 = str1;


http://www.cplusplus.com/reference/string/string/
Last edited on
Topic archived. No new replies allowed.