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?

>> And what is the value of *start? And how does the whole format string
>> look like?
> 
> They are as follows:
> 
>  > (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.


Georg

Reply via email to