title: JAX-RS and character encoding problems
body: <p>I am using Jax RS and have simple POST WS, that takes InputStream, that contains MIME message (xml + file). </p>
  
  <p>The MIME message is in UTF-8, file contained as a body part is an email message in MIME RFC 822 in ISO-8859-1 encoding, that I'm converting to PDF using Aspose.</p>
  
  <p>When running as a webservice, the resulting PDF has incorrect characters (ø, å etc.). But when I tried to use the exact input, but reading it from file instead and call the method with FileInputStream, the resulting PDF is OK.</p>
  
  <p>Here is the simplified version of the code:</p>
  
  <pre><code>@POST
  @Path(value = "/documents/convert/{flag}")
  @Produces("text/plain")
  public String convertFile(InputStream input, @PathParam("flag") String flag) throws WebApplicationException {
  
      FileInfo info = convertToPdf(input);
      return info.getResponse();
  }
  </code></pre>
  
  <p>If I run this as webservice it produces PDF with incorrectly encoded characters with "box" instead of some charcters (such as ø, å etc.). When I run the the same code with the same input by by calling</p>
  
  <pre><code>FileInputStream fis = new FileInputStream(file);
  convertFile(fis);
  </code></pre>
  
  <p>the resulting PDF has correct encoding (the WS is run on server, testing with file is done on my local machine).</p>
  
  <p>Could this be incorrect setting of locale on the server?</p>