Skip to content

Commit 1857aea

Browse files
committed
Fix encoding of string on Ruby 2.7
1 parent 9563758 commit 1857aea

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ext/rapidjson/extconf.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
$LDFLAGS += " -fsanitize=address"
1515
end
1616

17-
have_func("rb_interned_str", "ruby.h")
17+
have_func("rb_enc_interned_str", "ruby.h")
1818

1919
create_makefile("rapidjson/rapidjson")

ext/rapidjson/parser.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ struct RubyObjectHandler : public BaseReaderHandler<UTF8<>, RubyObjectHandler> {
6363
}
6464

6565
bool Key(const char* str, SizeType length, bool copy) {
66-
#ifdef HAVE_RB_INTERNED_STR
66+
#ifdef HAVE_RB_ENC_INTERNED_STR
6767
VALUE val = rb_enc_interned_str(str, length, rb_utf8_encoding());
6868
#else
69-
VALUE val = rb_str_new(str, length);
69+
VALUE val = rb_enc_str_new(str, length, rb_utf8_encoding());
7070
#endif
7171
return PutKey(val);
7272
}

0 commit comments

Comments
 (0)