加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – 解码?真正的性格

发布时间:2020-12-15 23:58:01 所属栏目:百科 来源:网络整理
导读:当我从twitter的Stream API读取数据然后写入xmlfile时. 但是有一些特殊的角色,如#55357;会导致错误(我的意思是当我在Chrome中打开xmlfile时,Chrome会说该角色出错了!) 我想在写入xmlfile之前将编码序列(#55357;)转换为真实字符()! 怎么实现这个? – – –
当我从twitter的Stream API读取数据然后写入xmlfile时.

但是有一些特殊的角色,如�会导致错误(我的意思是当我在Chrome中打开xmlfile时,Chrome会说该角色出错了!)

我想在写入xmlfile之前将编码序列(�)转换为真实字符()!

怎么实现这个?

– – – – – – -添加 – – – – – – –

这是XMLFile内容:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<text>@carlyraejepsen would be a dream if you follow me,please follow me?,I love you so much you're my inspiration</text>
<text>someone please bring me a caramel apple and a mocha from black cat. i'll love you forever</text>
<text>“@G_MartinFlyKick: Marry me Juliet.I love you and that's all I really know.”&#55357;&#56834;&#55357;&#56834;&#55357;&#56834;&#55357;&#56834;&#55357;&#56834;</text>
<text>"I need to see a picture of him cuz Im trying to imagine you guys making love and all I see is u climbing on top of a big question mark"lmao</text>
<text>@District3music hi,I LOVE YOU follow me please? &amp;lt;3 xx 23</text>
<text>RT @syardley_: So appreciative of my family and people I love,wouldn't be where I am without them. #thankful</text>
<text>#DISTRICT3HALLOWEENFOLLOWSPREE #DISTRICT3HALLOWEENFOLLOWSPREE #3EEKERFROMTHENETHERLANDS love you! Please follow ? @District3music x42</text>
<text>Arguably my favorite electronic music producer @Kluteuk is coming back to Toronto on Dec 22nd. So stoked. Guy has made so many tunes I LOVE.</text>
<text>The stakes are high,the water's rough,but this love is ours.</text>
<text>@NiallOfficial Answer me,I love you very much. Venezuela loves. jhgj</text>
<text>Love this shit http://t.co/qSP79NKx</text>
</root>

以下是Chrome的错误:

This page contains the following errors:

error on line 5 at column 91: xmlParseCharRef: invalid xmlChar value 55357
Below is a rendering of the page up to the first error.
字符参考&#55357;表示代理代码点(U D83D),因此尝试将其转换为字符是错误的.它不是一个角色,甚至不是半个角色.

您需要追溯到生成引用的位置.原因可能是字符编码混乱.在UTF-16中,可以出现代理代码单元,但是当数据被解释为字符时,必须成对处理.转换为另一种编码或转向字符引用.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读