Some files not analyzed by Sonar "Invalid character found in file"

I have several files that are not parsed with the following message:

Invalid character found in the file [file name with full path] on line 9 for UTF-8 encoding. Correct the contents of the file or configure the encoding that will be used using the sonar.sourceEncoding property.

In Visual Studio, when I select File / Advance Save Options, the files were installed in Western Europe (Windows) - Codepage 1252.

I changed it to Unicode (UTF-8 with signatures) - Codepage 65001.

But SonarQube is still complaining about invalid characters. "Invalid characters" are German comments with Umlaut characters (ä, ö, ü)

What can I do to fix this (without deleting comments)?

+4
source share
2 answers

The SonarQube scanner for MSBuild and the SonarQube C # plugin currently expect all project files to be UTF-8 encoded - and this is hard-coded.

There is a ticket in a future version to improve this: https://jira.sonarsource.com/browse/SONARMSBRU-174

0
source

I got the same error Invalid Character encountered in filewhen the files were parsed XML. And I already had sonar.sourceEncoding=UTF-8in my properties file.

, Sonar XML. Update Center, . , - .

0

Source: https://habr.com/ru/post/1615576/