Skip to content

Commit a2277b1

Browse files
committed
[Truffle] - String#downcase should preserve the string encoding.
1 parent eb39810 commit a2277b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,10 @@ public DowncaseNode(DowncaseNode prev) {
440440
@Specialization
441441
public RubyString downcase(RubyString string) {
442442
notDesignedForCompilation();
443+
ByteList newByteList = ByteList.create(string.toString().toLowerCase());
444+
newByteList.setEncoding(string.getBytes().getEncoding());
443445

444-
return string.getContext().makeString(string.toString().toLowerCase());
446+
return string.getContext().makeString(newByteList);
445447
}
446448
}
447449

0 commit comments

Comments
 (0)