Boost logo

Boost :

Subject: Re: [boost] Silly Boost.Locale default narrow string encoding in Windows
From: Daniel James (dnljms_at_[hidden])
Date: 2011-10-29 12:23:15


On Saturday, 29 October 2011, Peter Dimov wrote:
>
>
> The "dir" command has no problem displaying arbitrary file names directly
> to the console (presumably via WriteConsoleW), but once it has to write to
> a file, it needs to convert to narrow and no code page other than 65001 can
> express the above file name.
>

This is not that relevant to the wider issue, but wide streams will work
for console output if you first do this:

    if (_isatty(_fileno(stdout))) _setmode(_fileno(stdout), _O_U16TEXT);
    if (_isatty(_fileno(stderr))) _setmode(_fileno(stderr), _O_U16TEXT);

i.e. set the output mode to UTF-16 when writing to the console. This only
works for recent versions of Visual C++. Obviously doesn't fix piped output.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk