# Encoding problem and configuration

**URL:** <https://community.sonarsource.com/t/encoding-problem-and-configuration/74305>\
**Category:** SonarQube Server / Community Build\
**Tags:** encoding, configuration\
**Created:** [October 11, 2022, 12:44am UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305 "2022-10-11T00:44:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![CarlosF1](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carlosf1/32/15550_2.png) [@CarlosF1](https://community.sonarsource.com/u/CarlosF1)\
**Post date:** [October 11, 2022, 12:44am UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305/1 "2022-10-11T00:44:28Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [October 12, 2022, 12:21pm UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305/2 "2022-10-12T12:21:49Z")

</div>

Hi Carlos,

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

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![CarlosF1](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carlosf1/32/15550_2.png) [@CarlosF1](https://community.sonarsource.com/u/CarlosF1)\
**Post date:** [October 29, 2022, 12:15am UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305/3 "2022-10-29T00:15:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [October 31, 2022, 3:12pm UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305/4 "2022-10-31T15:12:07Z")

</div>

Hi Carlos,

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

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![CarlosF1](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carlosf1/32/15550_2.png) [@CarlosF1](https://community.sonarsource.com/u/CarlosF1)\
**Post date:** [October 31, 2022, 3:30pm UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305/5 "2022-10-31T15:30:00Z")

</div>

Hi Ann,

Here’s an example, in this case it’s using the java compiler:

```auto
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

```

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [October 31, 2022, 3:43pm UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305/6 "2022-10-31T15:43:46Z")

</div>

Hi,

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

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![CarlosF1](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carlosf1/32/15550_2.png) [@CarlosF1](https://community.sonarsource.com/u/CarlosF1)\
**Post date:** [October 31, 2022, 3:57pm UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305/7 "2022-10-31T15:57:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [October 31, 2022, 4:00pm UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305/8 "2022-10-31T16:00:51Z")

</div>

Hi Carlos,

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

&nbsp;  
🤷‍♀️  
Ann

---

<div class="post-metadata">

**Author:** ![Ezhilarasi\_D](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ezhilarasi_d/32/52785_2.png) [@Ezhilarasi\_D](https://community.sonarsource.com/u/Ezhilarasi_D)\
**Post date:** [December 20, 2023, 1:07pm UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305/9 "2023-12-20T13:07:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [January 3, 2024, 4:14pm UTC](https://community.sonarsource.com/t/encoding-problem-and-configuration/74305/10 "2024-01-03T16:14:41Z")

</div>

Hi @Ezhilarasi_D,

Welcome to the community!

> [@Ezhilarasi\_D](#):
>
> this same encoding problem

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.

&nbsp;  
HTH,  
Ann
