rapidxml读取包含中文路径的xml解析错误的解决方法

from http://blog.csdn.net/qinwei4072880/article/details/38865179

1、rapidxml不支持中文路径。

2、rapidxml不支持Unicode xml必须为utf-8编码。

解决方法:

#ifdef _UNICODE

setlocale(LC_ALL, "Chinese-simplified"); // 设置中文环境
USES_CONVERSION;
file<> doc(W2A(lpszXml));


setlocale(LC_ALL, "C"); // 还原
#else
file<> doc(lpszXml);
#endif
xml_document<> XmlAnalyse;    
XmlAnalyse.parse<0>(doc.data()); 

 

posted @ 2014-12-02 19:35  小 楼 一 夜 听 春 雨  阅读(1763)  评论(0编辑  收藏  举报