Skip to content

Commit df7a08c

Browse files
committed
utf8
1 parent 6478c6a commit df7a08c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ext/rapidjson/cext.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define RAPIDJSON_H 1
33

44
#include "ruby.h"
5+
#include "ruby/encoding.h"
56

67
#ifdef __SSE2__
78
#define RAPIDJSON_SSE2

ext/rapidjson/parser.hh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include "cext.hh"
4+
35
#include "rapidjson/reader.h"
46

57
using namespace rapidjson;
@@ -37,7 +39,7 @@ struct RubyObjectHandler : public BaseReaderHandler<UTF8<>, RubyObjectHandler> {
3739
}
3840

3941
bool String(const char* str, SizeType length, bool copy) {
40-
VALUE string = rb_str_new(str, length);
42+
VALUE string = rb_enc_str_new(str, length, rb_utf8_encoding());
4143
return PutValue(string);
4244
}
4345

0 commit comments

Comments
 (0)