Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 使用RapidXml解析日语汉字时出错_C++_Xml_Unicode_Xml Parsing_Rapidxml - Fatal编程技术网

C++ 使用RapidXml解析日语汉字时出错

C++ 使用RapidXml解析日语汉字时出错,c++,xml,unicode,xml-parsing,rapidxml,C++,Xml,Unicode,Xml Parsing,Rapidxml,我在尝试解析包含特定汉字的xml文件时遇到问题: 退 调试后,我发现问题出在RapidXml的这个函数中: struct text_pure_no_ws_pred { static unsigned char test(Ch ch) { return internal::lookup_tables<0>::lookup_text_pure_no_ws[static_cast<unsigned char>(ch)]; } }; c

我在尝试解析包含特定汉字的xml文件时遇到问题:

退

调试后,我发现问题出在RapidXml的这个函数中:

struct text_pure_no_ws_pred
{
    static unsigned char test(Ch ch)
    {
        return internal::lookup_tables<0>::lookup_text_pure_no_ws[static_cast<unsigned char>(ch)];
    }
};


const unsigned char lookup_tables<Dummy>::lookup_text_pure_no_ws[256] = 
    {
      // 0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
         0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 0
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 1
         1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 2
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  // 3
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 4
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 5
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 6
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 7
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 8
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 9
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // A
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // B
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // C
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // D
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // E
         1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1   // F
    };
struct text\u pure\u no\u ws\u pred
{
静态无符号字符测试(Ch)
{
返回内部::查找\表格::查找\文本\纯\否\ ws[静态\强制转换(ch)];
}
};
const unsigned char lookup_tables::lookup_text_pure_no_ws[256]=
{
//01 2 3 4 5 6 7 8 9 A B C D E F
0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 0
1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 1
1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 2
1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  // 3
1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 4
1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 5
1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 6
1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 7
1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 8
1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  // 9
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//A
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//B
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//C
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//D
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//E
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1//F
};
汉字在哪里退. 此函数返回false。为什么?对于所有其他字符,它返回true。
你知道吗?

看起来Ch包含一个Unicode值<代码>静态强制转换(0x9000)为0


您需要一个包含超过256个值的表。

RapidXML不支持仅限Unicode的完整UTF-8

见:

你唯一的选择是:将汉字转换成UTF-8,并希望它能工作。转换为非Unicode代码页,并希望它能与RapidXML一起工作。

“UTF-8”相当于“完全Unicode”。也许您想说RapidXML不完全支持UTF-16/。