title: Malformed input or input contains unmappable characters
body: <p>I'm having the following problem with a Maven project on our Jenkins server while running the Sonarqube maven plugin in a Jenkins pipeline.</p>
  
  <pre><code>[INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 01:54 min
  [INFO] Finished at: 2017-11-14T11:42:51+00:00
  [INFO] Final Memory: 74M/606M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project pandora-parent-pom: Malformed input or input contains unmappable characters: src/main/webapp/images/D??rogations.ep
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
  Caused by: org.apache.maven.plugin.MojoExecutionException: Malformed input or input contains unmappable characters: src/main/webapp/images/D??rogations.ep
      at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36)
      at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:80)
      at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:139)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
      ... 20 more
  Caused by: java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: src/main/webapp/images/D??rogations.ep
      at sun.nio.fs.UnixPath.encode(UnixPath.java:147)
      at sun.nio.fs.UnixPath.&lt;init&gt;(UnixPath.java:71)
      at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281)
      at sun.nio.fs.AbstractPath.resolve(AbstractPath.java:53)
      at org.sonar.api.batch.fs.internal.DefaultInputFile.path(DefaultInputFile.java:83)
      at org.sonar.api.batch.fs.internal.DefaultInputFile.file(DefaultInputFile.java:75)
      at org.sonar.api.batch.fs.internal.PathPattern$RelativePathPattern.match(PathPattern.java:101)
      at org.sonar.batch.scan.filesystem.LanguageDetection.isCandidateForLanguage(LanguageDetection.java:124)
      at org.sonar.batch.scan.filesystem.LanguageDetection.language(LanguageDetection.java:97)
      at org.sonar.batch.scan.filesystem.InputFileBuilder.completeAndComputeMetadata(InputFileBuilder.java:98)
      at org.sonar.batch.scan.filesystem.FileIndexer$1.call(FileIndexer.java:164)
      at org.sonar.batch.scan.filesystem.FileIndexer$1.call(FileIndexer.java:161)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  </code></pre>
  
  <p>The file itself is named Dérogations.ep .</p>
  
  <p>The part of the Jenkinsfile which contains the Sonar execution</p>
  
  <pre><code>stage('Sonar') {
                  withSonarQubeEnv('SonarQube') {
                      updateGitlabCommitStatus(name: 'sonar', state: 'running')
                      configFileProvider([configFile(fileId: 'ec266a3e-2586-4b2c-b0bb-386603d5a4ef', variable: 'MAVEN_SETTINGS')]) {
                          sh "export"
                          sh "${mvnHome}/bin/mvn org.jacoco:jacoco-maven-plugin:prepare-agent install -s $MAVEN_SETTINGS -Pcoverage-per-test -Dmaven.test.failure.ignore"
                          sh "export"
                          sh "${mvnHome}/bin/mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -s $MAVEN_SETTINGS -Dsonar.branch=${env.BRANCH_NAME} -Dmaven.test.failure.ignore"
                          sh "export"
                          jacoco()                    
                      }
                      updateGitlabCommitStatus(name: 'sonar', state: 'success')
                  }
              }
  </code></pre>
  
  <p>The export call returns (amongst others) these params, which I assigned to our build node.</p>
  
  <pre><code>export LANG='en_US.UTF-8'
  export LC_ALL='en_US.UTF-8'
  export LC_COLLATE='en_US.UTF-8'
  export LC_CTYPE='en_US.UTF-8'
  </code></pre>
  
  <p>The maven-compiler-plugin and maven-resources-plugin are also configured in UTF-8 and the Sonar logs also suggest that everything is nicely in UTF-8 (except for one file which is in ISO-8859)</p>
  
  <pre><code>[INFO] -------------  Scan MP services jenkins
  [INFO] Base dir: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services
  [INFO] Working dir: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar
  [INFO] Source paths: pom.xml, src/main/java
  [INFO] Test paths: src/test/java
  [INFO] Binary dirs: target/classes
  [INFO] Source encoding: UTF-8, default locale: en_US
  [INFO] Index files
  [INFO] 299 files indexed
  [INFO] Quality profile for java: MP
  [INFO] Sensor Lines Sensor
  [INFO] Sensor Lines Sensor (done) | time=14ms
  [INFO] Sensor JavaSquidSensor
  [INFO] Configured Java source version (sonar.java.source): 7
  [INFO] JavaClasspath initialization
  [INFO] JavaClasspath initialization (done) | time=1ms
  [INFO] JavaTestClasspath initialization
  [INFO] JavaTestClasspath initialization (done) | time=3ms
  [INFO] Java Main Files AST scan
  [INFO] 293 source files to be analyzed
  [INFO] 196/293 files analyzed, current file: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/src/main/java/be/MP/xxx/MP/dao/impl/HistoriqueActionServiceImpl.java
  [INFO] 283/293 files analyzed, current file: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/src/main/java/be/MP/xxx/MP/service/impl/SourceAuthentiqueServiceImpl.java
  [INFO] 293/293 source files have been analyzed
  [WARNING] Classes not found during the analysis : [javax.portlet.PortletRequest]
  [INFO] Java Main Files AST scan (done) | time=21386ms
  [INFO] Java Test Files AST scan
  [INFO] 6 source files to be analyzed
  [INFO] 6/6 source files have been analyzed
  [INFO] Java Test Files AST scan (done) | time=334ms
  [INFO] Sensor JavaSquidSensor (done) | time=21757ms
  [INFO] Sensor PmdSensor
  [INFO] Execute PMD 5.4.2...
  [INFO] Java version: 1.7
  [INFO] PMD configuration: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/pmd.xml
  [INFO] PMD configuration: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/pmd-unit-tests.xml
  [INFO] Execute PMD 5.4.2 done: 2375 ms
  [INFO] Sensor PmdSensor (done) | time=2379ms
  [INFO] Sensor CheckstyleSensor
  [INFO] Execute Checkstyle 7.3...
  [INFO] Checkstyle configuration: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/checkstyle.xml
  [INFO] Checkstyle charset: UTF-8
  [INFO] Execute Checkstyle 7.3 done: 1605 ms
  [INFO] Sensor CheckstyleSensor (done) | time=1607ms
  [INFO] Sensor SCM Sensor
  [INFO] SCM provider for this project is: git
  [INFO] 299 files to be analyzed
  [INFO] 299/299 files analyzed
  [INFO] Sensor SCM Sensor (done) | time=3669ms
  [INFO] Sensor FindBugs Sensor
  [INFO] Loading findbugs plugin: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/findbugs/fb-contrib.jar
  [INFO] Loading findbugs plugin: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/findbugs/findsecbugs-plugin.jar
  [INFO] Findbugs output report: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/findbugs-result.xml
  The following classes needed for analysis were missing:
    org.junit.runners.model.Statement
    org.junit.Assert
    org.assertj.core.api.Assertions
    org.assertj.core.api.AbstractIntegerAssert
    org.assertj.core.api.ListAssert
    org.assertj.core.api.AbstractListAssert
    org.junit.rules.TestRule
    org.h2.Driver
    org.assertj.core.groups.Tuple
  [INFO] Sensor FindBugs Sensor (done) | time=23684ms
  [INFO] Sensor SurefireSensor
  [INFO] Property 'sonar.junit.reportsPath' is deprecated. Use property 'sonar.junit.reportPaths' instead.
  [INFO] parsing [/workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/surefire-reports]
  [INFO] Sensor SurefireSensor (done) | time=114ms
  [INFO] Sensor JaCoCoSensor
  [INFO] Analysing /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/jacoco.exec
  [INFO] No information about coverage per test.
  [INFO] Sensor JaCoCoSensor (done) | time=512ms
  [INFO] Sensor JaCoCoItSensor
  [INFO] JaCoCoItSensor: JaCoCo IT report not found: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/jacoco-it.exec
  [INFO] Sensor JaCoCoItSensor (done) | time=0ms
  [INFO] Sensor JaCoCoOverallSensor
  [INFO] Analysing /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/jacoco.exec
  [INFO] Analysing /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/jacoco-overall.exec
  [INFO] No information about coverage per test.
  [INFO] Sensor JaCoCoOverallSensor (done) | time=212ms
  [INFO] Sensor SonarJavaXmlFileSensor
  [INFO] Sensor SonarJavaXmlFileSensor (done) | time=2ms
  [INFO] Sensor Zero Coverage Sensor
  [INFO] Sensor Zero Coverage Sensor (done) | time=119ms
  [INFO] Sensor Code Colorizer Sensor
  [INFO] Sensor Code Colorizer Sensor (done) | time=4ms
  [INFO] Sensor CPD Block Indexer
  [INFO] JavaCpdBlockIndexer is used for java
  [INFO] Sensor CPD Block Indexer (done) | time=283ms
  [INFO] -------------  Scan MP Web UI jenkins
  [INFO] Base dir: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Webui
  [INFO] Working dir: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Webui/target/sonar
  [INFO] Source paths: src/main/webapp, pom.xml, src/main/java
  [INFO] Binary dirs: target/classes
  [INFO] Source encoding: UTF-8, default locale: en_US
  [INFO] Index files
  [WARNING] Invalid character encountered in file /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Webui/src/main/webapp/js/my/widgets/templates/TutorialWidget.html at line 3 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
  </code></pre>
  
  <p>The only way to make it work is adding <code>-Dsun.jnu.encoding=UTF-8</code> when doing the sonarqube analysis. Why does maven need this setting for the sonar-maven-plugin but not for anything else (like <code>mvn clean install</code>) ?</p>