sonar.sourceEncoding warning

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension) Sonar server :Version 9.9.4 (build 87374)

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

We are running scan on Cobol programmes and we are getting error as WARN Invalid character encountered in file /Cobol/XXXX.cbl at line 100 for encoding US-ASCII. Please fix file content or configure the encoding to be used using property ‘sonar.sourceEncoding’.

We have sonar encoding as UTF8. Can you please give us some insight why such warning comes ?

Regards

Roopali

Hi,

Your version is past EOL. You should update to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your update path is:

9.9.4 → 2025.1.4 → 2025.5 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

If the warning persists after update, please come back to us!

Hello , we have upgraded the sonar server to v2025.5 (113872) and still we see error of Sonar encoding. Can you give us some insight now why this warning comes still ? “ WARN Invalid character encountered in file XXXX.cbl at line 500 for encoding US-ASCII. Please fix file content or configure the encoding to be used using property ‘sonar.sourceEncoding’.”

Hi,

The warning is actually pretty clear. You’ve declared a US-ASCII encoding in your analysis parameters, but a non-ASCII character was found in a file at that location. You should take a look to see if that’s the character that was intended. If it is, then you should revisit your encoding setting.

 
HTH,
Ann