Converting to Unicode

When an RWUString is constructed from a non-Unicode character or string, the non-Unicode character or string is converted into Unicode. Some RWUString constructors accept RWUToUnicodeConverter arguments to specify explicitly how to convert from a non-Unicode string to a Unicode string. For example:

 

RWUToUnicodeConverter fromAscii("US-ASCII");

RWUString str("Hello World", fromAscii);

The constructor converts the string literal from US-ASCII to Unicode; the new RWUString str contains the Unicode representation of Hello World.

Non-Unicode strings can also be converted implicitly by specifying a default conversion context. For example:

 

RWUToUnicodeConversionContext fromAsciiContext("US-ASCII");

RWUString str = "hello";

See Conversion for more information on conversion.