From: Tuples Arefun Date: 2009-08-17T05:36:10+09:00 Subject: [ruby-core:24937] [Bug #1943] unexpected behavior of tr with unicode strings Bug #1943: unexpected behavior of tr with unicode strings http://redmine.ruby-lang.org/issues/show/1943 Author: Tuples Arefun Status: Open, Priority: Normal ruby -v: ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-darwin9.7.0] The unicode code point 8221 is to be replaced by 34, and not 43 wide = [12288, 65288, 65289, 65291, 12540, 8221] ascii = [32, 40, 41, 43, 45, 34] foo = [8221, 19997, 37329, 22825, 20351, 8221] bar = foo.pack('U*').tr(wide.pack('U*'), ascii.pack('U*')) bar.unpack('U*') => [43, 19997, 37329, 22825, 20351, 43] It works correctly in this example: [8221].pack('U*').tr([8221].pack('U*'), [34].pack('U*')).unpack('U*') => [34] Why, I don't know. ---------------------------------------- http://redmine.ruby-lang.org