title: Regex and ISO-8859-1 charset in java
body: <p>I have some text encoded in ISO-8859-1 which I then extract some data from using Regex.</p>
  
  <p>The problem is that the strings I get from the matcher object is in the wrong format, scrambling chars like "ÅÄÖ".</p>
  
  <p>How do I stop the regex library from scrambling my chars?</p>
  
  <p>Edit: Here's some code:</p>
  
  <pre><code>private HttpResponse sendGetRequest(String url) throws ClientProtocolException, IOException
  {
      HttpGet get = new HttpGet(url);
      return hclient.execute(get);
  }
  private static String getResponseBody(HttpResponse response) throws IllegalStateException, IOException
  {
      InputStream input = response.getEntity().getContent();
      StringBuilder builder = new StringBuilder();
      int read;
      byte[] tmp = new byte[1024];
  
      while ((read = input.read(tmp))!=-1)
      {
          builder.append(new String(tmp), 0,read-1);
      }
  
      return builder.toString();
  }
  HttpResponse response = sendGetRequest(url);
  String html = getResponseBody(response);
  Matcher matcher = forum_pattern.matcher(html);
  while(matcher.find()) // do stuff
  </code></pre>