string_cleaner¶ ↑
Just add a method .clean to String which does:
-
convert invalid UTF-8 strings from ISO-8859-15 to UTF-8 to fix them
-
recognize euro char from both ISO 8859-15 and Windows-1252
-
replace rn and r with n normalizing end of lines
-
replace control characters and other invisible chars by spaces
Supports only Ruby 2.6+
Install¶ ↑
sudo gem install string_cleaner
Example usage¶ ↑
"\210\004".clean # => " "
Copyright¶ ↑
Copyright © 2009 Joseph Halter. See LICENSE for details.