java.nio.file.InvalidPathException on non-ascii paths while UTF-8 is configured

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      We get the following errors when building a maven project in Jenkins when file paths contain non-ascii characters:
      java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: ./target/test/resources/com/itextpdf/ñoñ-ascîî

      This only happens on EC2 instances we spin up automatically using the Amazon EC2 plugin (https://plugins.jenkins.io/ec2/).

      Following the guidelines on
      https://support.cloudbees.com/hc/en-us/articles/360004397911-How-to-address-issues-with-unmappable-characters, we checked the encoding of the JVM by looking at the following system properties on the EC2 instance:
      • file.encoding: UTF-8
      • sun.jnu.encoding: UTF-8

      Although these properties already seemed ok, we also tried fixing the issue by adding -Dfile.encoding=UTF-8 to the JVM Options in the Cloud configuration.

      Like indicated on the cloudbees article, we also checked the Locale of the system by looking at the environment variables.
      If we run an Execute shell section of a Freestyle Project with env | grep LANG we get the following return: LANG=en_US.UTF-8
      If we ssh to the machine and run env | grep LANG we get the following return: LANG=C.UTF-8

      If we run the maven command directly on the machine, there are no issues with special characters.
      So in other words the following command works in a ssh terminal but gives errors when run in an Execute shell section of a Freestyle Project:
      /home/ubuntu/jenkins/tools/hudson.tasks.Maven_MavenInstallation/M381/bin/mvn --file /home/ubuntu/jenkins/workspace/tmp/ñoñ-ascîî/pdfocr/pom.xml clean

      We tried using other Maven versions and Java versions without suffice.

            Assignee:
            FABRIZIO MANFREDI
            Reporter:
            Marco Andries
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: