c - xmlEscapeEntities : char out of range - Error

标签 c xml linux libxml2

我用 C 语言编程并使用 libxml 生成 XML 文件,但我得到以下结果 错误:xmlEscapeEntities:字符超出范围。我从数据库中选取数据并将其存储在我生成的标签中(在生成 XML 文件期间)。

我想知道为什么我会收到此错误。造成这种情况的主要原因是什么? 代码尖晶石:

     xmlNodeSetContent(temp_id,(const xmlChar *)details[nCl1+0]);
            632                                 xmlNodeSetContent(temp_id2, (const xmlChar *)details[nCl1+1]);
            633                                 xmlNodeSetContent(temp_id3,(const xmlChar *)details[nCl1+2]);
            634                                 xmlNodeSetContent(temp_id4,(const xmlChar *)details[nCl1+3]);
            635                                 xmlNodeSetContent(temp_id5,(const xmlChar *)details[nCl1+4])

;

这里变量“details”具有从数据库中选取的值。
这是代码中出现此错误的部分。

最佳答案

我猜您提供的 xmlChar * 字符串不是正确的 UTF-8 字符串。所以它可能是用其他标准编码的,你需要先将其转换为 UTF-8。您可以使用例如 iconv library .

查看question about xmlChar

关于c - xmlEscapeEntities : char out of range - Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9602255/

相关文章:

php - Apache 服务器压缩和利用浏览缓存问题

c - 由于 MessageBoxEx 导致程序崩溃

xml - 如何通过 XSD 允许 XML 元素出现在任何地方?

c - Solaris 中的 get_random_bytes() 等效项

java - 使用 "JSP Document"/"JSP in XML notation"是否意味着输出 XHTML?

android - RelativeLayout 不显示所有按钮

c++ - 在 c/c++ 中使用函数 system() 调用管道传输到 where 的 gdb,以记录堆栈跟踪 - 在 fd 0 上检测到错误挂断

c++ - 使用 std::cin 语句使自动超时

控制终端和 GDB

c++ - 如何在 C++ 中初始化指向特定内存地址的指针