Skip to content
Permalink
Browse files
Digest#hexdigest should produce US-ASCII strings.
  • Loading branch information
headius committed Nov 4, 2014
1 parent 8d24996 commit 5c6293c871e0b6b7dcce3458e7971dfc73d2004f
Showing 1 changed file with 2 additions and 1 deletion.
@@ -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;
@@ -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)

0 comments on commit 5c6293c

Please sign in to comment.