For feature parity between Ruby 1.8 and others, restore replacement behavior to eliminate invalid sequences instead of replacing with ?