SAX解析器不承认窗户-1255编码 [英] SAX Parser doesn't recognize windows-1255 encoding

查看:139
本文介绍了SAX解析器不承认窗户-1255编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作在Android上的RSS解析器
 (升级解析器我在互联网上找到)。
据我所知SAX解析器从XML标签自动识别编码,但是当我试图解析编码声明不解析它并抛出和异常窗户-1255饲料。
我试过几件事情:

I'm working on a rss parser in android (upgrading a parser I found on the internet). From what I know SAX Parser recognize the encoding automatically from the xml tag, but when I try to parse a feed that declare windows-1255 encoding it doesn't parsing it and throws and exception. I tried few things:


final InputSource source = new InputSource(feed);
Reader isr = new InputStreamReader(feed);
source.setCharacterStream(isr);


  • 我甚至尝试告诉他具体的编码。

  • I even tried telling him the specific encoding.

    source.setEncoding("Windows-1255");
    


  • 想看看定位器:

  • Tried to look at the locator:

    @Override
    public void setDocumentLocator(Locator locator) {
    }
    


  • 和它识别编码为UTF-16。

    And it recognize the encoding as UTF-16.

    请帮我解决这个恼人的问题!
    对不起,用code中的混乱段中的code按钮拒绝出于某种原因。

    Please help me solve this annoying problem! Sorry for the mess with code snippets the code button refuse to work for some reason.

    推荐答案

    机会是平台本身并不了解窗口-1255的编码。毕竟,这是一个基于Windows的编码 - 我不希望的依赖的上它是可以在其他任何平台,特别是移动的人那里的东西一般都砍倒在必须拥有的选项

    Chances are the platform itself doesn't know about the "windows-1255" encoding. After all, it's a Windows-based encoding - I wouldn't want to rely on it being available on any other platforms, particularly mobile ones where things are generally cut down to the "must-have" options.

    这篇关于SAX解析器不承认窗户-1255编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆