WARNING : There are problems with file encoding in the source code. Please check the scanner logs for more details

Hi folks,

I got a warning in Sonarqube after analyzed a project.

There are problems with file encoding in the source code. Please check the scanner logs for more details.

I checked the Sonar scanner for the logs but there is no log directory or file there and also checked the Sonarqube logs as well but no use.

I am using TeamCity as CI server and I integrated SonarQube for SAST. And I use separate build agent (in teamcity) for this project.

Plz help to find the issue. Thanks

Regards,
Khopi

Hi @khopithan ,

The scanner logs are the same logs from the TeamCity output of logs during your build. Look for the keyword “project key” and search the output from your build and that is where you scanner logs are.

Joe

Hi @Joe,

Thank you for your reply. I found the line which caused the warning. So I tried several JVM parameters like -Dsonar.sourceEncoding=utf-8, -Dsonar.jproperties.sourceEncoding=ISO-8859-1 and etc. Unfortunately, the warning is still there.

Actually, Its a commented thing (special character) that causes the warning

a - Copy

Plz help to solve this. Thanks

Best,
Khopi

Hi Khopi,

You will probably need to go into the file within your IDE and change the file encoding in there. Google search how to change file encoding of a file in your IDE of choice, then try a sonar analysis in addition to setting the sonar.sourceEncoding parameter.

In the worst case, just delete that character, which looks like an apostrophe.

Joe

Hi Joe,

Yeah I reported about this to Development team. So they will do that. Thanks again.

Regards,
Khopi

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.