I am currently experiencing this problem when running an analysis scan in Sonarqube:
error: unmappable character for encoding Cp1252
In the sonar-project.properties file, I have tried adding the following 2 parameters (1 at a time) but none seem to work for this issue:
sonar.sourceEncoding=UTF-8
sonar.sourceEncoding=CP-1252
My question is, does this parameter require something to be added from the console interface side?
I tried reviewing this page: https://docs.sonarqube.org/7.4/analysis/analysis-parameters/
But I don’t understand exactly where I would have to place the parameter as the admin.
Thanks in advance for any help or assistance,
Carlos
Sorry for the delayed response, my SonarQube version is 8.9.1.44547
I’m currently having trouble running the analysis scans, I get either 1 of the 2 for several files in the scan:
error: unmappable character for encoding Cp1252
error: unmappable character for encoding UTF8
Here’s an example, in this case it’s using the java compiler:
0:40:16 [javac] E:\views\CURR-SONAR\FrontOfficeBO\business\rules\dc\misc\DCROPReasonableOpportunityInfoAidBO.java:27: error: unmappable character for encoding UTF8
00:40:16 [javac] String header = "5.100.300.15 REASONABLE OPPORTUNITY PERIOD (42 CFR 435.956(b))| Medical program requests are approved for the?reasonable?opportunity?period of 80 days with a mandatory?HEWMAN?for individuals who have made a declaration of citizenship or satisfactory status and for whom?TRS?is unable to verify citizenship or satisfactory status.";
00:40:16 [javac] E:\views\CURR-SONAR\CorrespondenceBO\common\src\us\business\rules\co\CoHPTANFPrintWriter.java:350: error: unmappable character for encoding UTF8
00:40:16 [javac] * #C6a: All Cash ? Except Support Services and
These are the settings used for the java compiler, but what I don’t understand is, if I were to add encoding as utf8 or cp1252, I would still get the encoding errors, so I’m not sure if it’s possible to add multiple encodings:
I am facing this same encoding problem with sonar. My files are using Cp1252 encoding. How do we map it in Sonar? Because when i give this in sonar.sourceEncoding I dont get any results.
The problem initially reported by the original poster came from compilation, not analysis. So if you’re getting the same error message, you should look at your compile process.