diff options
author | Jean Boussier <[email protected]> | 2024-10-24 16:04:50 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2024-11-01 13:04:24 +0900 |
commit | 3782600f0f4f2f70a4d17f025fde6c096f82b424 () | |
tree | 8525ebd02821006520cdd9c1f22a59372a624eb3 /ext/json/parser/parser.rl | |
parent | f2b8829df0092409c944aafeac03f72ab2a6e7ac (diff) |
[ruby/json] Emit warnings when dumping binary strings
Because of it's Ruby 1.8 heritage, the C extension doesn't care much about strings encoding. We should get stricter over time. https://.com/ruby/json/commit/42402fc13f
-rw-r--r-- | ext/json/parser/parser.rl | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -693,9 +693,12 @@ static VALUE convert_encoding(VALUE source) if (encindex == binary_encindex) { // For historical reason, we silently reinterpret binary strings as UTF-8 if it would work. - // TODO: Deprecate in 2.8.0 - // TODO: Remove in 3.0.0 - return rb_enc_associate_index(rb_str_dup(source), utf8_encindex); } return rb_str_conv_enc(source, rb_enc_from_index(encindex), rb_utf8_encoding()); |