0

Iaは、次のコンテンツタイプのページのコンテンツを取得しようとしています。

meta content = "text / html; charset = iso-8859-1" http-equiv = "Content-Type"

このようなクラスHttpConnectionを使用するこのiamの場合

HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestProperty("Content-Type", "text/html;charset=iso-8859-1");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));

StringBuilder response = new StringBuilder();
String inputLine;

while ((inputLine = in.readLine()) != null){
        response.append(inputLine);
    }
in.close();

Respionseにはたくさんの「?」があります そのため、テキストは文字セットでエンコードされていませんでした。charset iso-8859-1でエンコードされた応答を取得するためにidは何ができますか?

4

1 に答える 1