title: converting ISO-8859-1 to UTF-8 in servlet response
body: <p>I have a servlet which retrieves data from an Oracle database. The encoding in the database is Latin1. Following code works fine for the browser:</p>
  
  <pre><code>resp.setCharacterEncoding("ISO-8859-1");
  resp.getWriter().write(result);
  </code></pre>
  
  <p>but I need to be able to return UTF-8, like so:</p>
  
  <pre><code>utfResult = ???;
  resp.setCharacterEncoding("UTF-8");
  resp.getWriter().write(utfResult);
  </code></pre>
  
  <p>In order to achieve this I have tried many syntaxes, none of which worked.</p>
  
  <p>The system is Tomcat 7 on Java 7. Thank you for your support.</p>
  
  <p>To answer to the request for more detail:</p>
  
  <p>with the first version, all the characters appear fine in the browser but not in the NodeJS program which uses the data.</p>
  
  <p>when I replace the <code>resp.setCharacterEncoding("ISO-8859-1");</code> with <code>resp.setCharacterEncoding("UTF-8");</code> the character öäüèéà are replaced by ? </p>