Websphere 8.5.5 UTF-8 encoding issue
<p>I have a problem with my application on <em>Websphere 8.5.5</em>. It's a spring rest application that is used to send email. In my service I receive the mail details and I use spring to forward it to the receivers. It works fine but when I try to send messages with non ascii character the message arrives with the special characters replaced by a question mark. The <em>UTF-8</em> encoding doesn't work. In my pc the application runs on Liberty Profile server and initially it doesn't work either. I googled the problem and found that spring needs a filter to interpret the special characters, so I added this lines to my 
<em>web.xml</em></p>

<pre><code>&lt;filter&gt;
      &lt;filter-name&gt;CharacterEncodingFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;encoding&lt;/param-name&gt;
          &lt;param-value&gt;UTF-8&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
       &lt;filter-name&gt;CharacterEncodingFilter&lt;/filter-name&gt;
    &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
</code></pre>

<p>On Liberty works fine but when I deploy the app on Websphere it doesn't. </p>

<p>I tried to directly translate the message in utf-8 with the String constructor:</p>

<pre><code>new String(byteArray, "UTF-8")
</code></pre>

<p>and the same thing happens. It works on liberty but it doesn't on Websphere. 
Then I found that you can force WebSphere to use <em>UTF-8</em> by adding these JVM Arguments:</p>

<pre><code>-Dclient.encoding.override=UTF-8
-Dfile.encoding=UTF-8
</code></pre>

<p>like explained in this answer: 
<a href="https://stackoverflow.com/questions/18188694/character-encoding-issues-on-websphere">Character encoding issues on websphere</a></p>

<p>I set the parameters on my server and restart like explained in many guides I found on the internet,
but obviously it didn't work. </p>

<p>This is the output of locale command in linux machine where WAS run:</p>

<pre><code>LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
</code></pre>

<p>I'am stuck and do not know what else to try. </p>

<p>Any help would be appreciated.</p>