hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: how to detect charset encoding from "meta http-equiv" ?
Date Sat, 18 Nov 2006 13:14:17 GMT
Hello Hakka,

> I tried to use httpclient, server doesn't set encoding within http response
> header, but does in the page itself with "meta http-equiv". How can I tell
> httpclient to detect (cyrillic) encoding from that thing ?

You can't. HttpClient will *never* consider the content it transports.
Start reading the response stream until you've got the encoding, then
create an InputStreamReader with that encoding for the rest of the data.
If the size of the page is small, you can also buffer the binary version
in memory and create the InputStreamReader on top of a ByteArryInputStream
to read the whole document.

hope that helps,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message