Boost logo

Boost Users :

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


On Wed, Jun 23, 2010 at 9:25 AM, John Dlugosz <JDlugosz_at_[hidden]> wrote:
>>
>> >
>> > I still think that Christoph is raising a valid issue. Even if you
>> > keep the file names as utf-8 strings, diagnostic_information doesn't
>> > know about it. I think it is possible for boost::errinfo_file_name to
>> > deal with the situation better, it is on my todo list.
>>
>> what do you have in mind? Currently the only idea I have is to treat
>> all utf-8 characters < 128 as ascii characters and escape the rest.
>>
> IMO, the exception class should take UTF-16 as wstring or L literals and "deal with it" internally if need be.  As long as it produces the original value again when queried, the internal format does not matter.

The Boost Exception framework itself doesn't set a limitation on what
you can stuff in exceptions. You can use something like:

typedef boost::error_info<struct wfile_name_,std::wstring> wfile_name;

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.

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