title: encoding issue with static resource
body: <p>I know this is a common issue but I have not been able to find an existing post which has an answer that solves this scenario.</p>
  
  <p>I'm getting a character encoding issue with an application that's currently being migrated from an old rack server to an AWS EC2 instance. Everything I've tried so far has not resolved the problem.</p>
  
  <p>I have a release build of my war file, let's say app-1.0.war that is deployed to Tomcat 7.0.32 (yes I know it's old, it's a legacy app and for now I want the EC2 instance to be as close as possible to the existing server) and the JDK is 1.7.0_07. The same build is on both environments.</p>
  
  <p>The old os is SLES (SUSE Linux Enterprise Server) and in AWS we are using Ubuntu 16.04.3 LTS.</p>
  
  <p>On both environments the locale is set as <em>en_GB.UTF-8</em>.</p>
  
  <p>Also, on both environments Tomcat's server.xml has URIEncoding="UTF-8" in the Connector.</p>
  
  <p>On both systems, if I use <em>file -i</em> on the minified Javascript file that's got the problem, it detects the file as being utf-8:</p>
  
  <pre><code>myjavascript.min.js: text/plain charset=utf-8
  </code></pre>
  
  <p>and when viewing the file content on the file system I can see that on both systems there is a string with a <strong>£</strong> sign in it.</p>
  
  <p>However if I use curl to request that same file through Tomcat, the old host serves it up correctly while the new environment replaces the pound symbol with <strong>��</strong>, even though both have content type <em>application/x-javascript;charset=UTF-8</em>.</p>
  
  <p>I have tried adding <em>-Dfile.encoding=UTF-8</em> to the args but that didn't help. It wasn't used in the old environment anyway.</p>