Sonar Scanning fails on Non-ASCII characters in file names

I am using sonarqube community edition and using sonar-runner to analyze my android project.

My organization is chinese based company and the China developers are using their native language for naming the files in code. So sonar scanner fails to analyze. One error below:

INFO: ------------------------------------------------------------------------


INFO: ------------------------------------------------------------------------

INFO: Total time: 10:58.678s

INFO: Final Memory: 84M/432M

INFO: ------------------------------------------------------------------------

ERROR: Error during SonarScanner execution

java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: android/vendor/comp/packages/comp-fw-api/sdk/COmPAPI-???.xlsx

The actual file name is COmPAPI-修订记录.xlsx (Chinese language)

I tried excluding by

sonar.exclusions=**/[^\p{ASCII}] # Excludes files with non-ASCII characters in their names

But sonar scan still find them and fails. Could anybody have faced and solved this issue?

Note: I am already using encoding format as UTF-8



Welcome to the community!

What version of SonarQube are you using? (Or maybe SonarCloud?) Also, what scanner flavor and version are you using?


We use
SonarQube - Community Edition Version 9.9.1 (build 69595)
Java 17.0.7 Eclipse Adoptium (64-bit)

I tried both of the option excluding the Non ASCII file (filenames). But It didn’t workout.



Thanks for those details. I’m going to flag this for the team.


Thanks. Any finding Ann?


I didn’t look into the exclusions, but the analysis should work if you set the locale at the system level. More specifically you can look into setting the environment variables LC_ALL and LANG.
There is a discussion about it on this topic.
You can see here the values we use in the docker image for the scanner CLI.

Hope that helps!

Hello Ann & Eric, Thanks you so much.

I resolved this issue by rebuilt my sonar-scanner docker image with executed the steps as given in this topic