This class is to pass UTF-8 string directly to String class.
Since String class usually regards char* string as environment specific multibyte string and try to convert it into UTF-8 string, this class is useful when reducing such undesired conversion. In practice, you can use this proxy object to call proper String constructor like the code below:
String str1("This string is regarded as the multibyte string.");
("This string is regarded as UTF-8 string."
In the first one, the string is environment specific multibyte string and since String preserves the string in UTF-8, it automatically convert the input string into UTF-8. But what you can see is that every character in the input string is ASCII 7bit character and every one thinks that there are no need to do conversion, and it's true. In the second one, the string is directly duplicated into String instance and there're no conversion, because the input string is regarded as UTF-8 string held in utf8s proxy object. For more information, see String class.
- See Also