-
Notifications
You must be signed in to change notification settings - Fork 344
Encoding::InvalidByteSequenceError with json 2.8.1 #697
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
Comments
Yes, I'm making the library progressively stricter about encoding, this one I think I should just note in the CHANGELOG.
This means you are passing an UTF-8 strings, but it's encoded as ASCII, looking at your code, it comes directly from ruby -e 'Encoding.default_external = Encoding::ASCII; p File.read("/etc/passwd").encoding'
#<Encoding:US-ASCII> I think you should check your |
A quick workaround can also be: JSON.load(File.read(model_path('docs-2.json', models_dir), encoding: Encoding::UTF_8)) |
Fix: ruby#697 This way even if `Encoding.default_external` is set to a weird value the document will be parsed just fine.
Fix: ruby/json#697 This way even if `Encoding.default_external` is set to a weird value the document will be parsed just fine. ruby/json@3a8505a8fa
Hi! Just wondering on the ETA on the gem update with this fix? TIA |
I'm just waiting a few days to see if some other issues are reported. |
2.8.2 was released. |
Hello @byroot - it's me again. We used the latest version of the
|
The backtrace clearly shows you are not using |
Aaaah, thanks for catching that. |
Fix: ruby#697 This way even if `Encoding.default_external` is set to a weird value the document will be parsed just fine.
`json` gem was made more strict wrt input string encoding [0] and if default locale is non-unicode (for example, default self-hosted GHA runner image in [1] does not have unicode locales) parsing could fail with `Encoding::InvalidByteSequenceError` [0] ruby/json#697 [1] https://github.com/actions/actions-runner-controller
Hello from the AWS SDK for Ruby. Hope you are well, @byroot ~ We have a customer who is using the I was able to reproduce the same error:
Here's where we use Thoughts? Thanks in advance! |
You customer is passing you an invalid string. It's marked as being ASCII, but contains UTF-8. Can't tell you any more than that. |
Hi again!
When using json 2.8.1 with Ruby 3.2.0 (for additional context, we use CodeBuild instances) - been running into the following error:
The
load_docs
referred above is here: https://github.com/aws/aws-sdk-ruby/blob/version-3/build_tools/services.rb#L93Could any of the recent changes have effected this? Reverting back to json 2.7.6 has fixed this for us.
InvalidByteSequenceError: "\xE2" on US-ASCII
feels like its trying to read it as ASCII instead of UTF-8.Any guidance will be appreciated. Thanks much!!!
The text was updated successfully, but these errors were encountered: