开发者

BufferedReader automatic encoding type

I am using BufferedReader to get data fro ma url.

 URL url = new URL("http://");
 BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), "windows-1251"));

On some url's encoding is windows-125开发者_开发知识库1 (cyrilyc) so i specified that in the reader. But on some ones, enconding is different, e.g KOI8-R Any way to get the data from both sources without using naother reader? I really can use only one here.


No, the BufferedReader cannot examine the Content-Enconding header. You have to supply that. Or use a library for encoding recognition/detection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜