-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
`split': invalid byte sequence in US-ASCII (ArgumentError) on ripper.rb #596
Comments
For the life of me I cannot get this thing to replicate. How are you running it through VSCode? Are you clicking "Format Document"? Or is it something else? |
Because I didn't point out clearly (my bad), you might have missed the Japanese char in the sample code. # あ <= HERE!!
d=[30644250780,9003106878,
30636278846,66641217692,4501790980,
671_24_603036,131_61973916,66_606629_920,
30642677916,30643069058];a,s=[],$*[0]
s.each_byte{|b|a<<("%036b"%d[b.
chr.to_i]).scan(/\d{6}/)}
a.transpose.each{ |a|
a.join.each_byte{\
|i|print i==49?\
($*[1]||"#")\
:32.chr}
puts
} I recently reinstalled OS and everything, and I just started having this issue. |
I'm having the same issue but in a different setup. I don't use any editor integration, just plain command line. My setup: OS: Debian Running
I can't count them all, there's too many. To track the issue I came up with a minimal example. Create a file 'ä' That's a valid Ruby program although it doesn't make any sense. Running I'm not an expert on character encodings. In my understanding since Ruby 2.0 the default encoding is UTF-8. Then why does this plugin read the files in US-ASCII? |
I really have no idea to be honest, and it's not replicating on my machine at all. I've got the exact same version of stuff as y'all do. Can one of you run Also please run |
I was facing this issue and had a I removed the H/T to @stmichael for pointing out the special character, which made me look for special characters like |
|
I'm running Prettier as well as these commands in a docker container. The base container is |
I found out a few more things and possibly a solution. I'll describe how I got there and thus hopefully help @github0013 in finding a solution for his setup. I printed the encoding of my test string in the terminal with Running |
This is how I fixed this problem currently. |
@stmichael that's the ticket! Thank you for finding that. Because of that investigation, I was finally able to track it down to:
That will reliably fail. I will add something that will detect the default encoding and handle it appropriately. |
Figured it out. Going out in the next release. #617 |
Metadata
Input
It seems if ran through VSCode,
source.encoding
would be recognized as "US-ASCII." And I get an error like below.When I run
bundle exec rbprettier --write
on the same file,source.encoding
is "UTF-8", and the format is done correctly.The text was updated successfully, but these errors were encountered: