Boost logo

Boost Users :

From: Filip Konvička (filip.konvicka_at_[hidden])
Date: 2007-05-25 08:25:49


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?

Thanks,
Filip

// _UNICODE must be defined; the "2" is never printed.
#include <string>
#include <iostream>
#include <sstream>
#include <locale.h>

#include <boost/date_time/posix_time/posix_time.hpp>
using boost::posix_time::ptime;
using boost::date_time::not_a_date_time;

int main() {
  wstring intl=L"\x161";
  wostringstream ss;
  ss << ptime(not_a_date_time);
  wcout << ss.str() << endl;
  wcout << intl << endl;
  wcout << L"1" << endl;
  wcout << ptime(not_a_date_time) << endl;
  wcout << intl << endl;
  wcout << L"2" << endl;
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net