Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost][exception] Wide-character design considerations
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-06-23 20:37:19


On Wed, Jun 23, 2010 at 5:04 PM, John Dlugosz <JDlugosz_at_[hidden]> wrote:
>> and then you can stuff it in and recover it from exceptions just fine.
>> The only issue is how boost::diagnostic_information (which returns a
>> std::string) will display a wfile_name, and I'm sure whatever it does
>> now isn't correct.
>>
>> So this isn't a trivial problem. Perhaps the correct thing to do is
>> document that boost::diagnostic_information returns a UTF-8 string, I
>> kind of prefer this to the other possibility, to add a
>> boost::wdiagnostic_information.
>>
>
> The Standard Library supplied with Visual C++ doesn't work with a UTF-8 "locale", and some versions give an error if you try to set that.

With Boost Exception this won't lead to a compile error.

> System functions take the "system code page" which might be different for file-name related functions, but did not support UTF-8 in the historical Windows line, but appears to be there for modern versions.  But, lots of code was written to support Windows 95 and is still out there.  Actually, I don't know if passing UTF-8 to the Windows API-A functions work!  Normally, one uses the UTF-16 (-W) forms.

No, it won't work, the non-W Windows functions don't understand UTF-8,
and the -W functions use UTF-16.

> So, making the human-reportable string be UTF-8 is simply not going to sit well with Windows programmers.  Make it UTF-16 and I can pass it to wcout<< or call TextOut, OutputDebugString, etc. with no problem.

Right, but UTF-16 won't sit well with non-Windows programmers. :)

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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