title: Liberty and OpenLiberty console/messages encoding to UTF-8
body: <p>I'm using OpenLiberty (automatically downloaded through its maven plugin) and my application is working fine (jax-rs and servlet/jsp outputs are fine).</p>
  <p>But the console (and messages.log) output is messy. Here is one example:</p>
  <pre><code>[INFORMAıåES] SRVE0253I: [io.openliberty.microprofile.health.3.0.internal] [/health] [HealthCheckServlet]: Destrui?Æo bem sucedida.
  </code></pre>
  <p>(expected is <code>[INFORMAÇÕES] ... Destruição bem sucedida.</code>)</p>
  <p>Clearly the messages are being printed as ISO-8859-1 in a UTF-8 capable terminal.</p>
  <p>Again, this question <strong>is not about the application</strong> running inside OpenLiberty container, which is completely UTF-8 and working fine. <strong>It is about the console output</strong>.</p>
  <p>A partially useful workaround would be to change its locale to <code>en-US</code> (so that OpenLiberty's messages wouldn't need any special character). Actually, I'd prefer english error messages, because they are easier to google for.</p>
  <p>I already tried <code>LANG=en-US.UTF8</code>, <code>LC_ALL=en_US</code> and <code>LC_MESSAGES=en_US</code>, to no avail.</p>
  <p>Project's effective <code>pom.xml</code> already declares <code>&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;</code>. Every file in my project is UTF-8. Project's <code>.editorconfig</code> <code>[*] charset = utf-8</code> (so vscode creates every new file as utf-8).</p>
  <p>I'm using bash MINGW64_NT-10.0-18363 + ConEmu-Maximus5 over Windows 10. <code>LANG</code> defaults to <code>=pt_BR.UTF-8</code>.</p>
  <p><strong>UPDATE</strong></p>
  <p>I've managed to set locale to en-US by adding
  <code>-Duser.language=en</code> to <code>${server.config.dir}/jvm.options</code>.</p>
  <p>To be honest, I did it through liberty-maven-plugin:</p>
  <pre><code>  &lt;properties&gt;
      ...
      &lt;liberty.jvm.language&gt;-Duser.language=en-US&lt;/liberty.jvm.language&gt;
      ...
    &lt;/properties&gt;
  </code></pre>
  <p>(and for <code>liberty-maven-plugin</code> itself, I've added <code>-Duser.language=en</code> to <code>MAVEN_OPTS</code>)</p>
  <p>Unfortunately, <code>-Dfile.encoding=UTF-8</code> did nothing.</p>
  <p><strong>UPDATE 2</strong></p>
  <p>I'm also running OpenLiberty inside an Arquillian driven junit test. Interestingly, when launched by arquillian, OpenLiberty honors the <code>-Dfile.encoding=utf-8</code> setting.</p>
  <p>For arquillian it could be configured through <code>arquillian.xml</code>:</p>
  <pre><code>&lt;arquillian ...&gt;
      &lt;container qualifier=&quot;liberty_managed&quot; default=&quot;true&quot;&gt;
          &lt;configuration&gt;
              ...
              &lt;property name=&quot;javaVmArguments&quot;&gt;-Dfile.encoding=utf-8&lt;/property&gt;
              ...
          &lt;/configuration&gt;
      &lt;/container&gt;
  &lt;/arquillian&gt;
  </code></pre>
  <p>Or in <code>${server.config.dir}/jvm.options</code> (as I did before):</p>
  <pre><code>-Dfile.encoding=utf-8
  </code></pre>
  <p>My conclusion is that <strong><code>-Dfile.encoding</code> is the right way to approach this issue</strong>. But somehow when launched by <code>liberty-maven-plugin</code> it is not honored. I'll take a closer look into its source code.</p>