Encoding problem and configuration

Hello all,

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

Hi Carlos,

What’s your version of SonarQube? (If you’re not sure, you can look in the page footer.)

 
Ann

Hello Ann,

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

Thanks and regards,
Carlos

Hi Carlos,

Can you share a small reproducer project? Or at least code snippets that include the unmappable characters?

 
Ann

Hi Ann,

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

Hi,

These errors seem to be coming from the Java compile (javac) process rather than from analysis.

 
Ann

Hi Ann,

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:

javac debug=“on” deprecation=“off” destdir=“${op.@{layermodule}.dst}” excludes=“${op.@{layermodule}.excludes} " failonerror=“true” fork=“on” includes=”${op.@{layermodule}.includes}" memoryInitialSize=“1536M” memoryMaximumSize=“5120M” nowarn=“on” srcdir=“${op.@{layermodule}.src}” verbose=“off”>

/javac>

If this is off topic for SonarQube, that’s ok, I will continue checking, but any help is gratefully appreciated.

Thanks!
Carlos

Hi Carlos,

Yeah, this topic is out of scope for the community.

 
:woman_shrugging:
Ann