C++ Logo

sg16

Advanced search

Convert between std::u8string and std::string

From: Lyberta <lyberta_at_[hidden]>
Date: Fri, 03 May 2019 11:12:00 +0000
So GCC 9 has been released and I'm starting migration to char8_t. The
first question is how to print std::u8string? Since std::cout works in
execution character set I need a way to convert string from UTF-8 to ECS.

It looks like the only way is to use std::c8rtomb but the API is very
cryptic and I don't understand it. Can someone provide an example code?


Received on 2019-05-03 13:12:56