title: Maven: Source Encoding in UTF-8 not working?
body: <p>i am converting a project from Ant to Maven and i'm having problems with a specific unit test which deals with UTF-8 characters. The problem is about the following String:</p>
  
  <pre><code>String l_string = "ČäÁÓý\n€řЖжЦ\n№ЯФКЛ";
  </code></pre>
  
  <p>The problem is that the unit test fails, because the String is read as the following:</p>
  
  <pre><code>?äÁÓý
  €????
  ?????
  </code></pre>
  
  <p>The java class is saved as UTF-8 and i also specify the build encoding to UTF-8 in the pom.xml.</p>
  
  <p>Here is an excerpt of my <strong>pom.xml</strong>:</p>
  
  <pre><code>...
  
  &lt;properties&gt;
  &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  &lt;/properties&gt;
  
  ...
  
  &lt;build&gt;
  &lt;plugins&gt;
      &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.1&lt;/version&gt;
          &lt;configuration&gt;
              &lt;source&gt;1.6&lt;/source&gt;
              &lt;target&gt;1.6&lt;/target&gt;
              &lt;encoding&gt;${project.build.sourceEncoding}&lt;/encoding&gt;
          &lt;/configuration&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
          &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.4&lt;/version&gt;
          &lt;configuration&gt;
              &lt;descriptorRefs&gt;
                  &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
              &lt;/descriptorRefs&gt;
          &lt;/configuration&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.15&lt;/version&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-surefire-report-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.15&lt;/version&gt;
      &lt;/plugin&gt;
   &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>Am i missing something here? It would be great, if someone could help me here.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Regarding the test code:</p>
  
  <pre><code>@Test
  public void testTransformation()
  {
  
      String l_string = "ČäÁÓý\n€řЖжЦ\n№ЯФКЛ";
      System.out.println( "&gt;&gt;&gt; " + l_string );
       c_log.info( l_string );
      StringBuffer l_stringBuffer = new StringBuffer();
      int l_stringLength = l_string.length();
  
      String l_fileName = System.getProperty( "user.dir" ) + File.separator + "transformation" + File.separator + "TransformationMap.properties";
      Transformation.init( l_fileName );
  
      Properties l_props = Transformation.getProps();
      for ( int i = 0; i &lt; l_stringLength; i++ )
      {
          char l_char = l_string.charAt( i );
          int l_intValue = (int) l_char;
          if ( l_intValue &lt;= 255 )
          {
              l_stringBuffer.append( l_char );
          }
          else
          {
              l_stringBuffer.append( l_props.getProperty( String.valueOf( l_char ), "" ) );
          }
      }
      c_log.info( l_stringBuffer.toString() );
      byte[] l_bytes = l_string.getBytes();
      byte[] l_transformedBytes = Transformation.transform( l_bytes );
      assertNotNull( l_transformedBytes );
  
  }
  </code></pre>
  
  <p>The following logic isn't really relevant(?) because after the first sysout the before mentioned "?" are printed instead of the correct characters (and therefore the following tests fail). There is also no use of a default platform encoding.</p>
  
  <p>The test converts each character according to the TransformationMap.properties file, which is in the following form (just an excerpt):</p>
  
  <pre><code>Ý=Y
  ý=y
  Ž=Z
  ž=z
  °=.
  €=EUR
  </code></pre>
  
  <p>It should be noted that the test runs without any problem when i build the project with Ant.</p>