SonarQube can not detect some files because of encode format

SonarQube : 8.1
SonarScanner : MSBuild 4.8
SonarC# : 8.1


There is a charset problem with some files. After i scaned project, i realized that some source files not exist on SonarQube Web UI. I trigged the scan from jenkins pipeline. In the Jenkins console log, there are lots of bug in the files that are not exist on SonarWebUI.
I did share a sample file in post From SonarQube 7.7 to 8.2 no issues found with sonarscanner msbuild.
And i have scaned the project with sonar.sourceEncoding property but this property didn’t work.
When i changed the source code file’s encode format to utf-8, it worked.


I thought it might be fixed if I use the ‘System.Text.Encoding.CodePages’ package.
But this solution did not work.

I have two source code file(File A and File B) under the same project and with same encode format.
In the image below you can see File A skipped.

I have added System.Text.Encoding.CodePages package and <CodePage>65001</CodePage> property to the project.
I have set sonar.sourceEncoding property to UTF-8. In the image below you can see now that, File B skipped.

Note : There are some Turkish character in the comment in File A and File B.
How can i solve this problem?
Thank you in advance.

Hi @ckonca,

We’ve changed the encoding processing in C# analyzer 8.13 that will be released as part of SonarQube 8.5. The release is expected next week.