title: Special and accented characters
body: <p>I am doing some work for a French client and so need to deal with accented characters. But I'm running into a lot of difficulty, I am hoping the solution is simple and that somebody can point it out to me.</p>
  
  <p>The string: <code>La Forêt pour Témoin</code>
  is converted to: <code>La For? pour T?oin</code></p>
  
  <p>Note the missing character following the accented character - the <strong>t</strong> following the <strong>ê</strong> and the <strong>m</strong> following the <strong>é</strong>.</p>
  
  <p>I have tried using StringEscapeUtils which was successful at escaping some characters, such as  <strong>ă</strong>. I have also built my own escape function which produces the same results (<strong>ă</strong> will work, <strong>ê</strong> will not).</p>
  
  <pre><code>private String escapeChars(String string) {
      char[] chars = string.toCharArray();
      String result = "";
      for (int i = 0; i &lt; chars.length; i++) {
          int c = chars[i];
          result += "&amp;#" + c + ";";
      }
      return result;
  } 
  </code></pre>
  
  <p>The project is running in eclipse using the App Engine plugin, I cannot narrow down whether the problem is caused by Java, App Engine, or SQLite.</p>
  
  <p>Any help is appreciated.</p>
  
  <p><strong>EDIT:</strong> I have found that string are malformed when simply displaying the the request parameter from a form. (ie, request.getParameter("string") already has malformed content).</p>
  
  <p>I have tried the meta-tag suggested by Daniel with no success. I think you are on the right track though, the header data of html document follows:</p>
  
  <pre><code>    &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  </code></pre>
  
  <p>When accented characters are hard-coded into a JSP they are displayed as intended.</p>
  
  <p><strong>EDIT:</strong> I have also added <code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code> to the very start of the page. </p>
  
  <p>I am very close to a solution. I have found that if I change the encoding of the page from within the browser form data is passed to the server properly. I cannot figure out how to make the browser auto detect page encoding.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  </code></pre>
  
  <p><strong>RESOLVED:</strong> I couldn't work out how to make the browser auto-detect UTF-8 encoding which java defaults to. So I have forced character encoding to ISO-8859-1 using request.setCharacterEncoding("ISO-8859-1"). </p>