[1.35.0][OSX][iostreams] Exception thrown with utf8 filename

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.

I am facing same problem as described below. With a non-english unicode path on OSX, wpath::external_file_string throws. It seems I am missing something trivial like local settings etc, anyone knows whats going on? SG On Fri, Jul 25, 2008 at 6:59 PM, Christophe Radondy <christophe.radondy@dmailer.com> wrote:
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.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

For others who might stumble on this page via google, this was a bug with boost and has been fixed. More details at, https://svn.boost.org/trac/boost/ticket/3928 SG On Tue, Feb 9, 2010 at 4:42 PM, Sachin Garg <schngrg@gmail.com> wrote:
I am facing same problem as described below. With a non-english unicode path on OSX, wpath::external_file_string throws.
It seems I am missing something trivial like local settings etc, anyone knows whats going on?
SG
On Fri, Jul 25, 2008 at 6:59 PM, Christophe Radondy <christophe.radondy@dmailer.com> wrote:
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.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Christophe Radondy
-
Sachin Garg