From: Do One Date: 2009-02-24T15:07:33+09:00 Subject: Re: encoding problem with tr() and hash keys Yes it was fixed yesterday with two consecutive patches, first one was not fixing it completely, but before I found how to reproduce a bug it is got fixed second time. (ruby 1.9.2 svn trunk) > Perhaps describe your environment in more detail? It works for me: How to reproduce a bug (to understand its traps) - 1. utf-8 env: $ ruby -v ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux] $ export LC_CTYPE=en_US.utf-8 $ irb irb(main):001:0> {"a" => 1}.key? "a".tr("z", "\u0101") => false Reproduced. Without utf-8 env you just don't see it: $ export LC_CTYPE=en_US $ irb irb(main):001:0> {"a" => 1}.key? "a".tr("z", "\u0101") => true 2. Even if your env is not utf-8 but your script have "encoding: utf-8" magic comment then bug will be there: $ cat a.rb #encoding: utf-8 p ({"a" => 1}).key?("a".tr("z", "\u0101")) $ ruby a.rb false 3. Or you are using -KU switch: $ ruby -KU -e 'p ({"a" => 1}).key?("a".tr("z", "\u0101"))' false I stuck on this by parsing word lists where some words having diacritical marks, some words getting worked out differently then others, code was correct and it was just plain crazy. -- Posted via http://www.ruby-forum.com/.