Hi,
I
try to do a cross-platform source code and I have this code.
I
compiled boost 1.35 in universal binaries on Mac OS 10.5.4 with intel platform
(IMAC core 2 duo 3Ghz)
The
same code works on linux (Ubuntu 8.0.4 and debian) and windows platforms but on
Mac OS 10.5 I have an exception in boost’s libraries.
We
compile on universal binaries with –fexceptions options of g++ 4.0.1 (Apple).
This
is my code:
<code>
boost::filesystem::wpath
unicode(L"abcdef\u0110");
boost::filesystem::ofstream
file(unicode.string()); // throws Invalid Argument on Mac
file
<< "abcdef" << endl;
file.close();
<endcode/>
If
I do this, it works:
<code>
boost::filesystem::path
utf8("abcdef\xC4\x90"); // \xC4\x90 == \u0110
boost::filesystem::ofstream
file(utf8.string()); // works ok
file
<< "abcdef" << endl;
file.close();
<endcode/>
When the ofstream is
created, this function is executed and crashes when I use Unicode parameters :
<code>
unicode.external_file_string();
// throws
uncaught
exception of type
boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
boost::filesystem::wpath_traits> >
-
boost::filesystem::wpath::to_external conversion error: Invalid argument
<endcode/>
Do
you have any idea? Is this a known bug? Did I miss a setting?
Thanks
for your help.
Regards,
Christophe.