-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Undesired string literal replacements when UTF8 locale not set in ENV #3311
Comments
I can confirm this is happening even with a |
I fixed the previous issues related to this, so I'll try to have a look at this one too. |
bbatsov
added a commit
that referenced
this issue
Sep 29, 2016
[Fix #3311] Detect encoding incompatibilities to spare bad autocorrection
❤️ |
Neodelf
pushed a commit
to Neodelf/rubocop
that referenced
this issue
Oct 15, 2016
When the external encoding is non unicode, but there are pure unicode characters in the source, parser replaces those with their equivalent control sequences, ending up in a bad autocorrection. Detect those cases. Also added a couple of regression tests and enabled running the whole test suite against ASCII external encoding.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We upgraded Rubocop from 0.38.0 to 0.41.2 in our app. Suddenly Rubocop wanted to replace stuff like:
"En kort men bra text varför jag ska försöka erövra denna trofé"
"En kort men bra text varf\u00F6r jag ska f\u00F6rs\u00F6ka er\u00F6vra denna trof\u00E9"
.However the first variant is valid UTF-8, and much more readable.
It turns out that our locale in ENV was not set up for UTF-8. See below for a reproducible example.
This is more of a FYI, since it's something new introduced between 0.38.0 and 0.41.2 that could be very confusing and irritating to end-users. I don't know if it should be fixed, just documented or nothing needs to be done about this. It took me some time to figure out Rubocop works as desired if I set my locale correctly.
Expected behavior
Actual behavior
One of the tests fail after changing locale in ENV.
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: