diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-17 10:06:58 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-17 10:06:58 +0000 |
commit | 792799e815f38f26cf8262e4d8c291ad955e651a (patch) | |
tree | faeea8ef57207c9069a9ef63b15a162cf2d950dd /ext/json/ext/parser/parser.rl | |
parent | cb7e9d616152441e197a853865c419b601e4d12c (diff) |
merges r23346 from trunk into ruby_1_9_1.
--
Update to JSON 1.1.4.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@24168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/ext/parser/parser.rl')
-rw-r--r-- | ext/json/ext/parser/parser.rl | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index 8325a93795..ca1876a7fc 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -1,8 +1,28 @@ #include "ruby.h" #include "unicode.h" +#if HAVE_RE_H +#include "re.h" +#endif +#if HAVE_RUBY_ST_H +#include "ruby/st.h" +#endif +#if HAVE_ST_H +#include "st.h" +#endif #define EVIL 0x666 +#ifndef RHASH_TBL +#define RHASH_TBL(hsh) (RHASH(hsh)->tbl) +#endif + +#ifdef HAVE_RUBY_ENCODING_H +#include "ruby/encoding.h" +#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding()) +#else +#define FORCE_UTF8(obj) +#endif + static VALUE mJSON, mExt, cParser, eParserError, eNestingError; static VALUE CNaN, CInfinity, CMinusInfinity; @@ -390,8 +410,14 @@ static VALUE json_string_unescape(char *p, char *pe) action parse_string { *result = json_string_unescape(json->memo + 1, p); - if (NIL_P(*result)) { fhold; fbreak; } else fexec p + 1; - } + if (NIL_P(*result)) { + fhold; + fbreak; + } else { + FORCE_UTF8(*result); + fexec p + 1; + } + } action exit { fhold; fbreak; } |