singlebrook / utf8-cleaner

MIT License
277 stars 44 forks source link

Would the String.scrub backport work? #19

Closed brendon closed 10 years ago

brendon commented 10 years ago

I posted a question on Stack Overflow: http://stackoverflow.com/a/26423207/129798 regarding improper characters causing encoding errors on my Rails app.

Someone replied and suggested I use String#scrub which is native in Ruby 2.1 but has a back port down to 1.9: https://github.com/hsbt/string-scrub

Would using this simplify utf8-cleaner a bit?

sbleon commented 10 years ago

That's good to know about. Thanks, @brendon !

I'm not sure if this would help, because we're dealing with invalid URI-encoded strings. So the strings aren't invalid (all of their chars are ASCII), but you can't decode them into UTF-8 before you clean them up.

brendon commented 10 years ago

Thanks @sbleon, that's fair enough :)

Have a great day!