Fix Windows encoding problems#2146
Open
Xanders wants to merge 3 commits into
Open
Conversation
kyrylo
requested changes
Nov 28, 2020
kyrylo
left a comment
Member
There was a problem hiding this comment.
Can you post the full exception(s)? FWIW we don't really test on Windows because we lack manpower. This solution doesn't look too clean to me.
Author
|
@kyrylo, thank you for reply! There is full exception for me: And: Steps to reproduce:
def тест
end
require 'pry'
Pry.start
The root of the problem is Windows default filesystem, please see below: In Ruby we cannot mix non-ASCII symbols with different encodings. So on Windows we should convert non-UTF-8 strings to UTF-8 before first use. This does not affect strings that are already in UTF-8. I just realized there was several places in code where converting is required too and pushed a new commit. And also another one to fix Rubocop warning. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! Thanks for the greatest project!! I just realized there are some bugs with filesystem encoding on Windows.
Dir.pwdgives me string in Windows-1251 encoding on my machine, so Pry starting process is broken with incompatibility exception. Alsowhereamicommand is broken too. So I think it's safe to performencode('UTF-8')on some strings from filesystem to ensure they are compatible with other. Everything works as expected on my machine after fixes.I'm using Pry 0.13.1 on Ruby 2.7.0 on Windows 10.