Reputation: 111
I am running the sonar scanner for my project with (-Dsonar.sourceEncoding=UTF-8) but I am getting the following error.
INFO: SonarQube Scanner 3.2.0.1227
INFO: SonarQube server 8.9.7
INFO: Default locale: "en_US", source code encoding: "UTF-8"
WARN: SonarScanner will require Java 11 to run, starting in SonarQube 9.x
...
ERROR: Error during SonarQube Scanner execution
ERROR: Malformed input or input contains unmappable characters: src/main/html/images/T??cnica.jpg
The word has a tilde.I have tried to exclude the .jpg files and the folder where this file is located but I still get the same error. Any solution?
Solution:
Inside the Jenkins container run the following commands to change the locale
apt-get update && apt-get install -y locales
sed -i '/es_ES.UTF-8/s/^# //g' /etc/locale.gen
locale-gen
update-locale LC_ALL="es_ES.UTF-8"
Upvotes: 6
Views: 4363
Reputation: 2019
TL;DR: add LC_ALL: "C.UTF-8"
to your YAML action on GitHub CI.
This question is relatively old, but yesterday I faced a very similar issue with Sonar: my GitHub action with SonarQube check was crashing with the following error:
11:31:28.355 ERROR Error during SonarScanner CLI execution
java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: path/to/the/file/file-with-umlaut-ä.html
Even though my Sonar server has a LC_ALL=en_US.UTF-8
locale. And since I haven't changed anything, the usual suspect was the GitHub action itself. I use the master
branch, which was recently updated to the v3.0.0
. See the action release history here.
But then I spotted the option to add LC_ALL
into my tests.yml
action file, like this:
- name: Run SonarQube scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
LC_ALL: "C.UTF-8"
After explicitly defining the LC_ALL
, everything started to work again.
Upvotes: 0
Reputation: 4738
For me, adding this to the Dockerfile was enough:
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
Upvotes: 5