某些引号和撇号无法正确解析
好吧,首先,我是 Android 编程新手。我已经学习了一些 Java,但我仍在学习(我们不是都这样)。 我正在尝试此处获取源代码形式并获取它正确读取 RSS 提要。目前我有两个问题。我将只陈述第一个,然后再发布第二个帖子。
我的设备上显示了 RSS 提要,但它不包含所有详细信息(描述)。当我通过浏览器加载提要时,我注意到一些引号和撇号变成了“和'。由于某种原因,这会阻止解析器正确解析它。任何帮助将不胜感激。
Okay, first, I'm a noob at android programming. I have taken some Java, but I'm still learning (aren't we all).
I'm trying to take the source code form here and have it read an RSS feed correctly. Currently I have 2 problems. I'll just state the first one and then post another post for the second.
One the RSS feed is displayed on my device, it doesn't include all of the details (description). When I load the feed through my browser I notice that some of the quotation marks and apostrophes are turned into " and '. For some reason this stops the parser from correctly parsing it. Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我面临着同样的问题。我使用UTF-8编码进行解析。但在制定 ISO-8859-1 后,一切都正常了。
我无法粘贴完整的代码,但只是为您提供一个可以进行更改的示例,如下所示:
我之前的解析代码是
After,我将其转换如下:
I was facing the same problem. I used UTF-8 encoding for parsing. But after making it ISO-8859-1, everything went correctly.
I cant paste the complete code but just a sample for you where you can make change is as folows:
My previous code for parsing was
After that I converted it as follows:
我找到了问题的原因。我必须在字符方法中设置一个字符串缓冲区。
一旦我这样做了,当我存储数据时,我只是将字符串缓冲区分配给“endelement”方法中的字符串。
之后一切都很好。
I found out the cause of the problem. I had to setup a string buffer in the charcters method.
Once I did that, i just assigned the stringbuffer to a string in the "endelement" method when I stored my data.
After that everything worked just fine.