Skip to content
Permalink
Browse files
[Truffle] - String#downcase should preserve the string encoding.
  • Loading branch information
lucasallan committed Dec 22, 2014
1 parent eb39810 commit a2277b175c4f957d53328b320be35bbd135bd9f4
Showing with 3 additions and 1 deletion.
  1. +3 −1 core/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
@@ -440,8 +440,10 @@ public DowncaseNode(DowncaseNode prev) {
@Specialization
public RubyString downcase(RubyString string) {
notDesignedForCompilation();
ByteList newByteList = ByteList.create(string.toString().toLowerCase());
newByteList.setEncoding(string.getBytes().getEncoding());

return string.getContext().makeString(string.toString().toLowerCase());
return string.getContext().makeString(newByteList);
}
}

0 comments on commit a2277b1

Please sign in to comment.