/** ================================* eli960@qq.com* http://linuxmail.cn/* 2020年08月31日* ================================*/#include "zcc/zcc_stdlib.h"zcc_namespace_begin;void xml_unescape_string(const char *data, int64_t len, std::string &content){if (len < 0){len = (int64_t)std::strlen(data);}char *ps = (char *)(void *)data, *end = ps + len;for (; ps < end;){int ch = ps[0];if (ch == '<'){break;}ps++;if (ch == '&'){if (ps[0] == '#'){ps += 1;int u = 0, x = 10;if ((ps[0] == 'x') || (ps[0] == 'X')){x = 16;ps++;}for (; ps < end; ps++){if (ps[0] == ';'){break;}u = u * x + hex_char_to_int(ps[0]);}char wchar[6 + 1];int nlen = ncr_decode(u, wchar);if (nlen > 0){content.append(wchar, nlen);}}else{if (!strncmp(ps, "lt;", 3)){ps += 3;ch = '<';}else if (!strncmp(ps, "gt;", 3)){ps += 3;ch = '>';}else if (!strncmp(ps, "amp;", 4)){ps += 4;ch = '&';}else if (!strncmp(ps, "apos;", 5)){ps += 5;ch = '\'';}else if (!strncmp(ps, "quot;", 5)){ps += 5;ch = '"';}else{ch = 0;}if (ch){content.push_back((char)ch);}}}else{content.push_back((char)ch);}}}std::string xml_unescape_string(const char *data, int64_t len){std::string content;xml_unescape_string(data, len, content);return content;}zcc_namespace_end;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型