tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: c++: how to print UTF-8 characters in locale?



On Mon, Aug 05, 2019 at 07:34:40AM +0200, Martin Husemann wrote:
> What I don't get (and Thomas asked) is: if you query the locale separator
> string via a <char> based facet I would expect a multibyte character
> string to be returned, and writing that via "cout <<" should work.
> Jörg said it would not work (and apparently it did not), but I fail to
> see why (or if the code used in that experiment was wrong).

The problem is that the locale facet is specified to return a single
char_t and not a string or array. That's why cout can't print anything
reasonable here. There is a secondary question on whether cout should
internally use the full string.

Joerg


Home | Main Index | Thread Index | Old Index