Skip to content

Commit

Permalink
Fix test suite on JRuby
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Nov 3, 2024
1 parent a0d6591 commit e08d222
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion java/src/json/ext/GeneratorState.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ public IRubyObject initialize_copy(ThreadContext context, IRubyObject vOrig) {
public IRubyObject generate(ThreadContext context, IRubyObject obj) {
RubyString result = Generator.generateJson(context, obj, this);
RuntimeInfo info = RuntimeInfo.forRuntime(context.getRuntime());
result.force_encoding(context, info.utf8.get());
if (result.encoding(context) != info.utf8.get()) {
result = (RubyString)result.dup();
result.force_encoding(context, info.utf8.get());
}
return result;
}

Expand Down

0 comments on commit e08d222

Please sign in to comment.