Daily C++11: More Unicode support

In yesterday’s episode we talked about the new Unicode support for string literals; the standard library has also been extended to support the new encodings:

  • std::string defined as std::basic_string<char>
  • std::wstring defined as std::basic_string<wchar_t>
  • std::u16string defined as std::basic_string<char16_t>
  • std::u32string defined as std::basic_string<char32_t>

New codecs are defined for translation between these types. The codecvt set was extended with quite a few more codecs, that allow translation between all the supported encodings. For a full reference, see the CPP reference site.

Also, new conversion classes have been added. wstring_convert and wbuffer_convert can be used in conjunction with the new codecs to convert a string or a buffer.

Example code, from the CPP reference site (as I am currently unable to run it with my present setup):

2 Replies to “Daily C++11: More Unicode support”

  1. dezGusty

    Hmm, what I meant to type:

    Btw: Second code sample has html in it. [b] or [/b] is appearing in the code; you don’t need’em with [pre class=”brush:cpp”]

Comments are closed.

Sprijină dorinlazar.ro


Uniunea Europeană vrea să vă informez că nu vă folosesc datele personale pentru nimic. Și o fac aici.