cleanup hash_char_positions, tested in Ruby 1.8, 1.9, 2.0