2

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"
Víctor DC
  • 51
  • 6
  • Please provide enough code so others can better understand or reproduce the problem. – Community May 04 '22 at 05:39
  • When I run sonarscanner I get the following error. ERROR: Malformed input or input contains unmappable characters: src/main/html/images/T??cnica.jpg I am using the UTF8 encoding – Víctor DC May 04 '22 at 06:27

1 Answers1

1

For me, adding this to the Dockerfile was enough:

ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
CodeMonkey
  • 4,067
  • 1
  • 31
  • 43