intellij-ideagradlecharacter-encodinggradlewintellij-idea-2016

Intellij IDEA overwrites 'i' character with ASCII of 'ı' in gradle-wrapper.properties file


There is a weird problem which I am not sure about its source.

I am using Intellij IDEA (2016 3.3) and Gradle (v3.3). I use Windows 10, Turkish OS.

Gradle has a wrapper properties file. (./gradle/wrapper/gradle-wrapper.properties)

The content of that file, which is generated by Gradle:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip

When I open a Gradle project in Intellij, the last line of that file turns into this:

distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-b\u0131n.zip

Intellij overwrites bin into b\u0131n. I checked what \u0131 refers to, and it is ASCII code for 'ı' letter.

And because the URL is broken, I can't build the project.

There are a lot of 'i' letter in that file (not mentioning the whole project), but somehow Intellij turns that specific 'i' in 'bin' into ASCI of 'ı'.

I have this problem for long, but for the first time Intellij insists overwriting it when I try to correct the letter manually. The only difference this time is that I created a multiple-modules containing project which means there are more than one gradle-wrapper.properties file.

Do any of you know why and how to solve this?


Solution

  • After some research, I found the origin of the bug and it is not Intellij IDEA but Gradle.

    @Input
        public String getDistributionUrl() {
            if (distributionUrl != null) {
                return distributionUrl;
            } else if (gradleVersion != null) {
                return locator.getDistributionFor(gradleVersion, distributionType.name().toLowerCase()).toString();
            } else {
                return null;
            }
        }
    

    https://github.com/gradle/gradle/blob/master/subprojects/build-init/src/main/groovy/org/gradle/api/tasks/wrapper/Wrapper.java#L314

    toLowerCase() method in here uses my locale (tr-TR) so the output of "BIN".toLowerCase() is "bın".

    I added an issue in Gradle-dev Google group and suggested a solution.