Boost logo

Boost :

Subject: [boost] [Locale] Stream manipulator bug
From: Alexander Lamaison (awl03_at_[hidden])
Date: 2010-10-09 13:15:03

The latest version of Boost.Locale is doing something wierd to stream
manipulators. For example, the following code should print 63:2c:7f. If
you uncomment the line that sets the global locale to use a boost::locale
instance, it prints 990:440:127. It seems to be ignoring the std::hex
manipulator and doing something strange with std::width.

#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

#include <boost/locale.hpp>

std::string hexify()
        std::ostringstream hex_hash;

        hex_hash << std::hex << std::setfill('0');

        unsigned int data[] = {99, 44, 127};
        for(size_t i = 0; i < 3; ++i)
                if (!hex_hash.str().empty())
                        hex_hash << ":";

                hex_hash << std::setw(2) << data[i];

        return hex_hash.str();

int main()
        using boost::locale::generator;
        generator gen;


        std::cout << hexify() << std::endl;

This is on Windows 7 with Boost.Locale compiled to only use the Win32


Easy SFTP for Windows Explorer (

Boost list run by bdawes at, gregod at, cpdaniel at, john at