string-scrub gem now supports Ruby 1.9.3.
I think string-scrub is better than this ad-hoc routine.