Menu

XMLDocument LoadFile with Chinese Characters in path

Harry Boy
2015-05-13
2023-04-11
  • Harry Boy

    Harry Boy - 2015-05-13

    I'm using TinyXML2 to load an xml document from disk.

    The path of the file (configFileName) is a std::wstring and I am converting it to string like so:

    tinyxml2::XMLDocument doc;
    std::string fileName(configFileName.begin(), configFileName.end());
    doc.LoadFile(fileName.c_str());
    

    This works but there may be times where my program runs on a double byte OS such as Chinese or Korean and the conversion from wstring to string above will loose the characters.

    How can I load a path such as the following:
    wstring wPathChinese = L"C:\我明天要去上海\在这里等我\MyProgram";

     
  • James Lawrence

    James Lawrence - 2025-01-25
    Post awaiting moderation.

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.