$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Kirit Sælensminde (kirit.saelensminde_at_[hidden])
Date: 2007-05-25 23:35:45
Filip KonviÄka wrote:
> Hi,
> 
> in MSVC 8.0 _UNICODE build, after I send a ptime to wcout, I can no 
> longer print "international" characters. When I use a temporary 
> wostringstream for printing the ptime, everything is OK. Minimal repro 
> see below (the "2" at the end is never printed). With some characters 
> like the "Å¡" in the example, the output is totally cut off; with others, 
> like "á", the codepage is changed, so the characters are displayed 
> incorrectly.
> 
> Any suggestions?
This is a problem in the MSVC libraries. If you print a character above 
code 255 then the stream crashes and is good for nothing afterwards. 
Only std::wstringstream doesn't have this problem.
I think if you buy the Dinkumware libraries this works. The _cputws 
function does work as you would expect, but it can't be piped. The 
behaviour also changes if you run the program from a command shell with 
Unicode turned on ( cmd.exe /u).
I did talk to PJ Plauger about it on clc. This is what he explained:
"When you write to a wofstream, the wchar_t sequence you write gets 
converted to a byte sequence written to the file. How that conversion 
occurs depends on the codecvt facet you choose. Choose none any you get 
some default. In the case of VC++ the default is pretty stupid -- the 
first 256 codes get written as single bytes and all other wide-character 
codes fail to write. "
Kirit