C++ Logo

SG16

Advanced search

Subject: Convert between std::u8string and std::string
From: Lyberta (lyberta_at_[hidden])
Date: 2019-05-03 06:12:00


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?




SG16 list run by herb.sutter at gmail.com