-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Eclipse WTP encoding handling #546
Conversation
Spotless always provides decoded string to WTP.
There could be further investigation in how far other formatters are affected by the content descriptors. |
...clipse-wtp/src/main/java/com/diffplug/spotless/extra/eclipse/wtp/sse/ContentTypeManager.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great except the Charset.defaultCharset()
comment. With your permission, I'll make that one single change, verify that the tests still pass, and then publish a new eclipse-wtp
.
Sorry, need to have another look... Am afraid I never used encoding in depth when working with Java. Find the function description partly misleading. |
Java strings are always "decoded" (as UTF-16). This internal code format is transparent to all interfaces. Encodings/Decodings to/from other formats are only accomplished on byte arrays/streams.
The fix looks great, thanks! |
I merged to publish, but made a few changes on master before publishing: eclipse-wtp 3.15.3 is now available on bintray/jcenter, but it is not available on mavencentral. I'm not able to sync, and not sure why. Hopefully it is a transient, I'll try again later today. |
the mavencentral sync has magically resolved. |
Fixes the WTP encoding handling.
Spotless always provides decoded string to WTP.
The original implementation did not provide any coding descriptions. Hence for HTML, the platform specific one were used. E.g. this affects all WTP clean-up tasks, not only HTML, but whether the others do a second decoding in the first place, has not been checked thoroughly.
Probably they do not.
Anyhow, the changed implementation assures that this part of the code common to all WTP formatters, behaves like that original WTP, though the input files are not directly accessed.