gpt4 book ai didi

c - xmlEscape实体 : char out of range - Error

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:08:49 25 4
gpt4 key购买 nike

我在 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 - xmlEscape实体 : char out of range - Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9602255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com