Why is there no rule for error "Invalid character encountered"

When running sonar-scanner I get this error reported to the terminal -> "
*WARN: Invalid character encountered *
in file com_joomlaupdate/restore.php
at line 6840
*for encoding UTF-8. *
Please fix file content or configure the encoding to be used using property ‘sonar.sourceEncoding’.

Checking the file and errors within (duplications etc) are recorded but the invalid character on line 6840 is not one of them (and there are many more repetitions of the same character)

Surely if processing is taken to recognise the situation and output a tailored message in the standard output warning - it should also have a rule (I looked but did not find) and a marker on the code screen pointing out the error condition so that someone could be assigned to fix it.

I’ve been seeing this warning as well, though technically the place I’ve seen it is for what appears to be a valid UTF-8 code, the Replacement Character, hex EF BF BD. Although I like the error, even for this valid UTF-8 since it reflects a place where I think something got accidentally translated improperly, in general, it is not so helpful having warnings in the logs. It’s better to have a check where the team can possibly see it. Warnings will tend to go unheeded.

I’ll file a bug about this issue.

Added this bug report - Invalid character warning UTF-8

Hi Harold,

sorry for the late answer. Your point definitely makes sense, and we believe that this should be covered using UI Warnings. We created SONAR-12559 to track this.

Thanks for your feedback!