#54 support for boost::filesystem

open
nobody
None
5
2011-01-13
2011-01-13
Jochen
No

LoadFile and SaveFile now work with boost::filesystem::path which adds support for unicode filenames on windows. It is even possible to work with utf8 filenames by imbueing an utf8-locale on boost::filesystem::path. This patch is for version 2.6.1.

Discussion

  • Jochen
    Jochen
    2011-01-13

    patch for tinyxml.cpp/h

     
    Attachments
  • Sukender
    Sukender
    2011-02-04

    Hi Jochen,

    I guess your patch may be enchanced. When you write:
    TIXML_STRING filename( _filename.string() );
    I guess that's dangerous because this implies a conversion with default "codecvt()", which may be whatever the user imbued in boost::filesystem. Actually for my apps, I imbue an UTF8 locale so that .string() returns UTF8, but what if it converts a path to a given code page ? For instance, if I got arabic or chinese characters and my codepage is Latin1, then I'll loose characters! The path becomes invalid.

    I guess this needs testing, but what about converting with a defined codec? Or maybe forcing string/wstring depending on the system would work (I sincerely don't know)?

    Cheers,

    Sukender