Skip to content

Be proactive about encoding mismatch#575

Merged
nedtwigg merged 14 commits intomasterfrom
feat/cautious-encoding
May 21, 2020
Merged

Be proactive about encoding mismatch#575
nedtwigg merged 14 commits intomasterfrom
feat/cautious-encoding

Conversation

@nedtwigg
Copy link
Copy Markdown
Member

As noted here, it is very destructive for Spotless to run an apply operation with an incorrect encoding set. If the encoding was incorrect, we should error loudly to prevent special characters from being changed.

This PR is just a draft - We can make the error message a lot better, and we can probably go faster by never re-encoding to an entire byte[], and instead just check against the existing byte[] as we go. That also makes it easier to create a good error message, especially for multibyte encodings like UTF-8.

@nedtwigg
Copy link
Copy Markdown
Member Author

If you've got time, I'd love your feedback @andrewfg

@nedtwigg nedtwigg marked this pull request as ready for review May 15, 2020 19:27
@nedtwigg nedtwigg merged commit aad37ce into master May 21, 2020
@nedtwigg nedtwigg deleted the feat/cautious-encoding branch May 21, 2020 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant