Use "?~" unless "~".ord is available.

Use `?~` on ruby 1.8.