From: Ryan Davis Date: 2009-10-04T17:17:04+09:00 Subject: Re: ruby 1.9: handling meta and control keys On Oct 4, 2009, at 00:28 , (rkumar) Sentinel wrote: > (rkumar) Sentinel wrote: >> 1.8 used to return an int for say ?\M-a or ?C-a (when user types >> meta-a >> or control-a). >> >> 1.9 returns a string as "\xE1" instead of 225. >> > > After further searching on : > http://blog.grayproductions.net/articles/what_is_a_character_encoding > > I found this: > > ?\M-a.getbyte(0) > > It works, however any suggestions on how i can write this so it works > for both 1.8 and 1.9 would be welcome. This is what I use in ruby_parser: # I hate ruby 1.9 string changes class Fixnum def ord self end end unless "a"[0] == "a"