
On Tue, Jun 22, 2010 at 10:11 AM, Rainer Deyke
On 6/22/2010 02:33, Christoph Heindl wrote:
Hello,
How do you guys deal with boost.exceptions and wide-character strings?
All my std::strings are utf-8. That fixes this problem:
Probably not all strings, if you want to do string manipulations std::wstring is a better fit. Filenames, yes, I keep as utf-8 std::strings too.
a) partially unreadable strings: when narrowing a boost::filesystem::wpath to fit into a boost::errinfo_file_name
And it reduces this problem to out-of-memory errors
To be fair, out-of-memory conditions are probably less common than bad utf-8 strings (which are also not very common, I'd think.) You are making a valid point though, it is true that adding error_info to exceptions may throw. The benefit of this behavior is that the postcondition is that the error_info has been added to the exception, which means that at the catch site you can assert on missing error_info. 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. Thanks, Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode