Georg Baum wrote:
Koji Yokota wrote:

Georg Baum wrote:
If you want to debug this fdurther it might be a good idea to write a
small standalone program that simply calls boost::format with the
problematic input.
boost::basic_format() itself seems working if it is called with
"ordinary" strings:

 > #include <iostream>
 > #include <boost/format.hpp>
 >
 > using namespace std;
 >
 > main()
 > {
 >         cout << boost::basic_format<char >("test %1$s \n") % "OK";
 > }

which prints out

test OK

That is expected, but does boost::basic_format<wchar_t>it also do that?

No, it doesn't compile. It complains that there is no matching function, which probablly means that in boost/boost/format/format_fwd.hpp:

#if !defined(BOOST_NO_STD_WSTRING)  && !defined(BOOST_NO_STD_WSTREAMBUF) \
    && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM)
    typedef basic_format<wchar_t >  wformat;
#endif

one of BOOST_NO_STD_WSTRING, BOOST_NO_STD_WSTREAMBUF or BOOST_FORMAT_IGNORE_STRINGSTREAM is defined.

 > (gdb) p *start
 > $38 = (const wchar_t &) @0x8b1e9c0: 49

49 is the ASCII value of the character '1'. That means that wrap_narrow() is
definitely wrong here, since it should simply return the input in this case
and not -65. It also means that boost::format is probably correct, since
the 1 is a part of the format string that the code we are lloking at needs
to parse.

That means that indeed something is wrong with your locale stuff, but I
don't understand at all why this does not change if you use the replacement
facets from Enrico that definitely work for ASCII input. The only way to
track this down is to step through the wrap_narrow() function with a
debugger. Then you will eventually see where the 49 is converted to -65.

Thank you. I will try to investigate it further.

Koji

Reply via email to