Diff formatting shows weird whitespace characters on Windows 10 (� and ╖ instead of ·)
- Lingua principale
- Java
- Stelle
- 5.6k
- Fork
- 559
- Merge medio
- 1g 14h
- PR unite (30g)
- 43
Descrizione
## Summary of problem
When outputting the details of what lines have format violations, the `·` characters representing whitespace are not rendering correctly in the Command Prompt, Android Studio & Intellij's console output on Windows 10. I tried the same project with the same IDEs and Gradle files on Mac OS Catalina and don't see the issue.
I use defaults fonts on Windows and in the IDEs. I tried other monospaced fonts and character encoding thinking it's something on my end. Didn't seem to have any effect. I'm suspecting something in the library is possibly using an encoding that isn't translating back to UTF-8 correctly.
Android Studio & Intellij's output (Windows 10)
```
Execution failed for task ':app:spotlessKotlinCheck'.
> The following files had format violations:
app\src\main\java\com\corwinjv\postmodernandroid\common\di\NetworkModule.kt
@@ -6,15 +6,14 @@
import�dagger.Provides
import�dagger.hilt.InstallIn
import�dagger.hilt.android.components.ApplicationComponent
+import�javax.inject.Singleton
import�okhttp3.OkHttpClient
import�retrofit2.Retrofit
import�retrofit2.converter.gson.GsonConverterFactory
-import�javax.inject.Singleton
@InstallIn(ApplicationComponent::class)
@Module
-class�NetworkModule
-{
+class�NetworkModule�{
����@Provides
����@Singleton
����fun�provideOkHttpClient():�OkHttpClient�{
@@ -24,7 +23,7 @@
����@Provides
����@Singleton
-����fun�provideProgrammingQuotesApi(okHttpClient:�OkHttpClient)�:�ProgrammingQuotesApi�{
+����fun�provideProgrammingQuotesApi(okHttpClient:�OkHttpClient):�ProgrammingQuotesApi�{
��������return�Retrofit.Builder()
... (8 more lines that didn't fit)
```
Command Prompt's output (Windows 10)
```
Execution failed for task ':app:spotlessKotlinCheck'.
> The following files had format violations:
app\src\main\java\com\corwinjv\postmodernandroid\common\di\NetworkModule.kt
@@ -6,15 +6,14 @@
import╖dagger.Provides
import╖dagger.hilt.InstallIn
import╖dagger.hilt.android.components.ApplicationComponent
+import╖javax.inject.Singleton
import╖okhttp3.OkHttpClient
import╖retrofit2.Retrofit
import╖retrofit2.converter.gson.GsonConverterFactory
-import╖javax.inject.Singleton
@InstallIn(ApplicationComponent::class)
@Module
-class╖NetworkModule
-{
+class╖NetworkModule╖{
╖╖╖╖@Provides
╖╖╖╖@Singleton
╖╖╖╖fun╖provideOkHttpClient():╖OkHttpClient╖{
@@ -24,7 +23,7 @@
╖╖╖╖@Provides
╖╖╖╖@Singleton
-╖╖╖╖fun╖provideProgrammingQuotesApi(okHttpClient:╖OkHttpClient)╖:╖ProgrammingQuotesApi╖{
+╖╖╖╖fun╖provideProgrammingQuotesApi(okHttpClient:╖OkHttpClient):╖ProgrammingQuotesApi╖{
╖╖╖╖╖╖╖╖return╖Retrofit.Builder()
... (8 more lines that didn't fit)
```
Android Studio 4.0's output (Mac OS Catalina)
```
Execution failed for task ':app:spotlessKotlinCheck'.
> The following files had format violations:
app/src/androidTest/java/com/corwinjv/postmodernandroid/ExampleInstrumentedTest.kt
@@ -1,13 +1,11 @@
package·com.corwinjv.postmodernandroid
+import·androidx.test.ext.junit.runners.AndroidJUnit4
import·androidx.test.platform.app.InstrumentationRegistry
-import·androidx.test.ext.junit.runners.AndroidJUnit4
-
+import·org.junit.Assert.assertEquals
import·org.junit.Test
import·org.junit.runner.RunWith
-import·org.junit.Assert.assertEquals
-
/**
·*·Instrumented·test,·which·will·execute·on·an·Android·device.
·*
app/src/main/java/com/corwinjv/postmodernandroid/App.kt
@@ -4,4 +4,4 @@
import·dagger.hilt.android.HiltAndroidApp
@HiltAndroidApp
-class·App·:·Application()
+class·App·:·Application()
app/src/main/java/com/corwinjv/postmodernandroid/common/di/NetworkModule.kt
@@ -6,15 +6,14 @@
import·dagger.Provides
import·dagger.hilt.InstallIn
import·dagger.hilt.android.components.ApplicationComponent
+import·javax.inject.Singleton
import·okhttp3.OkHttpClient
import·retrofit2.Retrofit
import·retrofit2.converter.gson.GsonConverterFactory
-import·javax.inject.Singleton
@InstallIn(ApplicationComponent::class)
@Module
-class·NetworkModule
-{
+class·NetworkModule·{
····@Provides
····@Singleton
····fun·provideOkHttpClient():·OkHttpClient·{
@@ -24,7 +23,7 @@
····@Provides
····@Singleton
-····fun·provideProgrammingQuotesApi(okHttpClient:·OkHttpClient)·:·ProgrammingQuotesApi·{
+····fun·provideProgrammingQuotesApi(okHttpClient:·OkHttpClient):·ProgrammingQuotesApi·{
········return·Retrofit.Builder()
... (8 more lines that didn't fit)
```
## gradle or maven version
Gradle - 6.1.1
## spotless version
5.5.1
## operating system and version
* Windows 10 Pro (19041.508)
* Android Studio 4.0
* Intellij IDEA 2019.3.4
## copy-paste your full Spotless configuration block(s)
**Root project Gradle file**
```
buildscript {
repositories {
// ...
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
// ...
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.5.1"
}
}
apply plugin: "com.diffplug.spotless"
// ...
```
**Subproject (app)'s Gradle file**
```
// ...
apply plugin: "com.diffplug.spotless"
spotless {
kotlin {
target 'src/*/java/**/*.kt'
ktlint()
}
}
// ...
```
## copy-paste the full content of any console errors emitted by `gradlew spotless[Apply/Check] --stacktrace`
See summary
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia riproducendo `gradlew spotlessCheck` con la configurazione Spotless 5.5.1 mostrata su Windows 10 e confronta l'output della console con quello di macOS. Traccia il punto di ingresso della formattazione delle differenze utilizzato da Kotlin; l'attività è completata quando i marcatori degli spazi bianchi vengono visualizzati coerentemente come `·` in Windows Command Prompt e nelle console degli IDE.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, kotlin
- Ambito
- build-system, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100