jaké je nastavené kódování se dá zjistit takto:
String charset = EntityUtils.getContentCharSet(entity);

Popřípadě text stránky:
String obsah = EntityUtils.toString(entity, "UTF-8");

Snad to pomůže ...

Petr



2012/12/7 Ivan Polak <ivan.po...@f4s.sk>

> ospravedlnujem sa, to som zabudol napisat, to som tam uviedol iba ako
> priklad, bola tam samozrejme ina adresa :-)
>
> Ivan
>
> 2012/12/7 Petr Franta <petr.fra...@gmail.com>:
> > Koukal jsem na stránku http://www.adresa.sk a je tam nastaveno:
> >
> > <meta http-equiv="Content-Type" content="text/html;
> charset=windows-1250">
> >
> > Petr
> >
> >
> >
> > 2012/12/7 Ivan Polak <ivan.po...@f4s.sk>
> >>
> >> Zdravim konferenciu,
> >>
> >> chcel som pouzit HttpClient z Apache HttpComponents Client
> >> (http://hc.apache.org/httpcomponents-client-ga/) a ziskat obsah
> >> jedneho webu, nasledovnym kodom:
> >>
> >> static StringBuffer getRequest() {
> >>         StringBuffer result = new StringBuffer();
> >>         HttpClient client = new DefaultHttpClient();
> >>         HttpGet request = new HttpGet("http://www.adresa.sk";);
> >>
> >>         HttpParams params = new SyncBasicHttpParams();
> >>         HttpProtocolParams.setContentCharset(params, "UTF-8");
> >>
> >>         request.setParams(params);
> >>
> >>         try {
> >>             HttpResponse response = client.execute(request);
> >>
> >>             HttpEntity entity = response.getEntity();
> >>             if (entity != null) {
> >>                 InputStream stream = entity.getContent();
> >>                 try {
> >>                     BufferedReader reader =
> >>                             new BufferedReader(new
> >> InputStreamReader(stream));
> >>                     String line;
> >>                     while ((line = reader.readLine()) != null) {
> >>                         result.append(line);
> >>                     }
> >>                 } finally {
> >>                     stream.close();
> >>                 }
> >>             }
> >>         } catch (Exception e) {
> >>             e.printStackTrace();
> >>         }
> >>         return result;
> >>     }
> >>
> >>
> >> vsetko je OK, ale ziskany obsah ma poskodenu diakritiku (cielovy web
> >> je urcite v kodovani UTF-8).
> >>
> >> prosim, neviete niekto poradit ako dosiahnut spravnu diakritiku.
> >>
> >> dakujem
> >>
> >> Ivan
> >
> >
>

Odpovedet emailem