summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-10-30 11:33:26 +0100
committergit <svn-admin@ruby-lang.org>2025-10-30 10:34:06 +0000
commit317f102cbb6d10cad3a5a7bb27f09bd39ec943c6 (patch)
treecd9e27f9550b4e2fa7fa5393020ac612efcd5a97 /ext/json
parent4b1279b6e9daf080b0ca4e97b6a5ee2dfa2d7077 (diff)
[ruby/json] Fix GeneratorError messages to be UTF-8 encoded
https://github.com/ruby/json/commit/965ba6c5d4
Diffstat (limited to 'ext/json')
-rw-r--r--ext/json/generator/generator.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/json/generator/generator.c b/ext/json/generator/generator.c
index f3f27b29d5..d04c8a9079 100644
--- a/ext/json/generator/generator.c
+++ b/ext/json/generator/generator.c
@@ -90,6 +90,7 @@ RBIMPL_ATTR_NORETURN()
#endif
static void raise_generator_error_str(VALUE invalid_object, VALUE str)
{
+ rb_enc_associate_index(str, utf8_encindex);
VALUE exc = rb_exc_new_str(eGeneratorError, str);
rb_ivar_set(exc, rb_intern("@invalid_object"), invalid_object);
rb_exc_raise(exc);