-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Encoding::InvalidByteSequenceError with json 2.8.1 #697
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.
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: