Skip to content

Commit

Permalink
Digest#hexdigest should produce US-ASCII strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Nov 4, 2014
1 parent 8d24996 commit 5c6293c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/ext/digest/RubyDigest.java
Expand Up @@ -39,6 +39,7 @@
import java.util.HashMap;
import java.util.Map;

import org.jcodings.specific.USASCIIEncoding;
import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.RubyFixnum;
Expand Down Expand Up @@ -146,7 +147,7 @@ private static ByteList toHex(byte[] val) {
}

private static IRubyObject toHexString(Ruby runtime, byte[] val) {
return RubyString.newStringNoCopy(runtime, ByteList.plain(toHex(val)));
return RubyString.newStringNoCopy(runtime, new ByteList(ByteList.plain(toHex(val)), USASCIIEncoding.INSTANCE));
}

@JRubyMethod(name = "hexencode", required = 1, meta = true)
Expand Down

0 comments on commit 5c6293c

Please sign in to comment.