summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-06-14 11:45:45 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2014-06-14 11:45:45 -0700
commitbf3e03e18faab91902baadfc8b4e650ecf1abeef (patch)
tree1f4ecd7fa1012b83629a775d14a3f738b7be0eee /ext
parent969d06b570ca01ff6ecf141e4c64610b63e158ef (diff)
downloadffi-yajl-bf3e03e18faab91902baadfc8b4e650ecf1abeef.tar.gz
symbolize_keys fix for 1.8.7
Diffstat (limited to 'ext')
-rw-r--r--ext/ffi_yajl/ext/parser/parser.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/ffi_yajl/ext/parser/parser.c b/ext/ffi_yajl/ext/parser/parser.c
index 323e619..de4f125 100644
--- a/ext/ffi_yajl/ext/parser/parser.c
+++ b/ext/ffi_yajl/ext/parser/parser.c
@@ -130,8 +130,13 @@ int map_key_callback(void *ctx, const unsigned char *stringVal, size_t stringLen
#endif
if ( get_symbolize_keys(ctx) == Qtrue ) {
+#ifdef HAVE_RUBY_ENCODING_H
ID id = rb_intern3((const char *)stringVal, stringLen, utf8Encoding);
key = ID2SYM(id);
+#else
+ VALUE str = rb_str_new((const char *)stringVal, stringLen);
+ key = rb_str_intern(str);
+#endif
} else {
key = rb_str_new((const char *)stringVal, stringLen);
#ifdef HAVE_RUBY_ENCODING_H