Problem with the filesystem::exists()

Hi folks, I´m stuck with an problem, when i try pass an accentued string to exists method: When i wrote in the code "C:\\ó.txt" and the file is under ANSI codification the function exists return true. But when i ask the input to the user the function return false. Ps: wstring in the basic_path template dont fix this. If someone know how and have a time to help me i will be very grateful

I'm using WindowsXP but I need a solution that works on any version of windows. The encoding of file names appears to be ANSI and the string that was passed as a parameter seems to be UTF-8. Here is a link to the problem that i'm having. http://boost.codepad.org/nmwVlgta

On Tue, Sep 27, 2011 at 12:49 PM, Danilo da Silveira Figueira
I believe it expects a std::string in ASCII or a std::wstring assuming UTF-16 on windows. If your file is not ascii, you need to either convert to the current internationalized code page (untested by me) or UTF-16. I had issues like this recently where on Linux we expect a std::string containing UTF-8, so we had the same thing happening on Windows. This didn't work for non-ascii items, so we convert to UTF-16 on windows, which then works properly. Brian

On Tue, Sep 27, 2011 at 01:04:36PM -0700, Brian Budge wrote:
Filesystem v3's path has functions and ctors accepting a codecvt facet as last default argument, which defaults to a codecvt(). If my reading of the standard are correct, that implies that it uses the current locale to convert filenames if needed. If you want to always feed in UTF-8, you need to have a suitable codecvt facet. -- Lars Viklund | zao@acc.umu.se
participants (3)
-
Brian Budge
-
Danilo da Silveira Figueira
-
Lars Viklund