From: "Eregon (Benoit Daloze)" Date: 2012-07-27T19:34:30+09:00 Subject: [ruby-core:46808] [ruby-trunk - Bug #6799] Digest::*.hexdigest returns an ASCII-8BIT String Issue #6799 has been updated by Eregon (Benoit Daloze). duerst (Martin D��rst) wrote: > So what should it return? [If you create a bug, saying what the expected behavior is (and also why you expect it) is quite important.] I thought it was clear enough, but indeed I should have mentioned it. An hexadecimal String like this should have the US-ASCII encoding, because, by definition, it only has ASCII characters ([a-f0-9]). This for example, makes YAML dump it as a binary String, and may cause other problems as the String is believed to be "binary", while it's not (#digest on the other hand has the ASCII-8BIT encoding, which is right). ---------------------------------------- Bug #6799: Digest::*.hexdigest returns an ASCII-8BIT String https://bugs.ruby-lang.org/issues/6799#change-28482 Author: Eregon (Benoit Daloze) Status: Feedback Priority: Normal Assignee: Category: ext Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-07-15 trunk 36395) [x86_64-darwin10.8.0] $ ruby -rdigest/sha1 -e 'p Digest::SHA1.hexdigest("a").encoding' # I'm happy to provide a patch. -- http://bugs.ruby-lang.org/