From: "Iñaki Baz Castillo" Date: 2009-02-23T22:54:56+09:00 Subject: Re: Improving hexadecimal escaping performance 2009/2/23 Robert Klemme : > Well, you can at least do this in 1.8 > > def self::hex_escape(str) > str.gsub(/[^a-zA-Z0-9_\-.]/n) {|m| sprintf("%%%02X", m[0]) } > end > > And this in 1.9 > > def self::hex_escape(str) > str.gsub(/[^a-zA-Z0-9_\-.]/n) {|m| sprintf("%%%02X", m.getbyte(0)) } > end Thanks, do you mean that "m[0]" in Ruby 1.9 has a different behaviour than in 1.8? maybe in 1.9 "m[0]" returns the first character (even if it's more than two bytes as "ñ", "€"...) while in 1.8 it returns just the firrst two bytes? PD: I've Ruby 1.9 (2007-12-25 revision 14709) and I don't have "getbyte()" method for String. Thanks a lot. -- Iñaki Baz Castillo