Ability to define .properties file encoding: new sonar.jproperties.sourceEncoding property
racodond opened this issue · comments
sonar.sourceEncoding
is not enough. Java source code can be encoded in UTF-8 and .properties file in ISO-8859-1.
Add a new sonar.jproperties.sourceEncoding
property, default value is ISO-8859-1.
Hello,
I finally found out why I stopped working on it. See #75 (comment) and especially https://groups.google.com/forum/#!searchin/sonarqube/encoding%7Csort:date/sonarqube/deim05PwjnI/-BcpNESiAQAJ.
I'm pissed off contributing to a product whose company looks down on contributors... But feel free to re-post the thread if you're eager to.
Cheers
Hmmm 🤔 I tested the pre-release snapshot, and it works correctly. It parses my *.properties
file which contains UTF-8 characters after I set sonar.jproperties.sourceEncoding=UTF-8
. The source code is displayed correctly in the Web UI. I have SonarQube 7.1. What doesn't work? I'll try to investigate that 😄
It works fine in your case because all your files are UTF-8 encoded.
It doesn't work properly (issue when source code is displayed) when Java code is UTF-8 encoded and Properties file are ISO-8859-1 encoded. This because I didn't find a way to tell the the code that is in charge of displaying code on the web interface to use the value of sonar.jproperties.sourceEncoding
instead of sonar.sourceEncoding
.
It's the only limitation...
I fully understand the problem now. I doubt SonarSource would add a support for different endcodings 😞 It seems to me that everyone is trying to use UTF-8 everywhere (e.g. Java 9 parses properties encoded in UTF-8), but I think it is a good step in simplifying our lives 😉
I'm pissed off contributing to a product whose company looks down on contributors...
Do you plan to stop developing this plugin?
I prepared a comparison how this feature, even with limitation, works great 😄
+-------------+------------------+-----------------------------+-----------------------------+
| java files | properties files | without this feature | with this feature |
+-------------+------------------+-----------------------------+-----------------------------+
| UTF-8 | ISO-8859-1 | properties broken in Web UI | properties broken in Web UI |
+-------------+------------------+-----------------------------+-----------------------------+
| UTF-8 | UTF-8 | analysis failures | ok |
+-------------+------------------+-----------------------------+-----------------------------+
| ISO-8859-1 | ISO-8859-1 | ok | ok |
+-------------+------------------+-----------------------------+-----------------------------+
I prepared a comparison how this feature, even with limitation, works great smile
I agree with you that it's better to fully support UTF-8 and "partially" support ISO-8859-1.
I'll try to revert the commits I reverted within the next few days. I'll keep you posted.
Do you plan to stop developing this plugin?
I'll see...
My teams would be very grateful for a new release with this feature soon 😉 Could I help you somehow? I can prepare a PR with all necessary commits 😄
Hello,
I'm afraid I'll stop maintaining the plugin. I'll let you fork the repo.
David