Boost logo

Boost Users :

Subject: Re: [Boost-users] [1.35.0][OSX][iostreams] Exception thrown with utf8 filename
From: Sachin Garg (schngrg_at_[hidden])
Date: 2010-02-09 06:12:01


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_at_[hidden]> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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