|
Boost Users : |
Subject: Re: [Boost-users] [boost][exception] Wide-character design considerations
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-06-24 14:19:46
On Thu, Jun 24, 2010 at 8:31 AM, John Dlugosz <JDlugosz_at_[hidden]> wrote:
>> What about:
>> - having boost::diagnostic_informationreturn a UTF-8 encoded string
>> for all error_info containing a std::wstring
>> - adding a boost::wdiagnostic_information
> No. The narrow form should be encoded based on the currently selected locale's settings. That is, after all, the whole point of having it. Other functions you pass it to will be expecting that.
The current documented behavior of boost::diagnostic_information is
that it converts error_info objects (of any type!) to string by
calling a user-defined to_string function, or (if no such overload
exists) by means of std::ostringstream (if that's not possible, a
compile error is NOT issued anyway.) So I suppose the narrow form is
encoded based on the currently selected locale unless the user
interferes by providing a custom to_string overload.
So, the question is how does std::ostringstream handle std::wstrings.
If the locale can be configured so that the std::wstring is converted
to UTF-8, I think that there is no need to change anything in Boost
Exception because (unless the user interferes)
boost::diagnostic_information's format will depend on the locale.
Someone please correct me if I got this wrong!
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