diff options
Diffstat (limited to 'java/src/json/ext/Parser.rl')
-rw-r--r-- | java/src/json/ext/Parser.rl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/java/src/json/ext/Parser.rl b/java/src/json/ext/Parser.rl index 6d9d4f9..73062cf 100644 --- a/java/src/json/ext/Parser.rl +++ b/java/src/json/ext/Parser.rl @@ -647,6 +647,10 @@ public class Parser extends RubyObject { } if (cs >= JSON_string_first_final && result != null) { + RuntimeInfo info = RuntimeInfo.forRuntime(context.getRuntime()); + if (info.encodingsSupported() && result instanceof RubyString) { + ((RubyString)result).force_encoding(context, info.utf8.get()); + } res.update(result, p + 1); } else { res.update(null, p + 1); |