Ruby 1.8 compatibilty fix.

The gsub match data are CHAR instead of STRING in Ruby 1.8 so we need to
call #chr on it so that we can then call #upcase.