artouiros
artouiros

Reputation: 3987

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-1251 (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.

Upvotes: 0

Views: 1177

Answers (1)

Michael-O
Michael-O

Reputation: 18430

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

Upvotes: 2

Related Questions