Created
March 22, 2012 02:39
-
-
Save ryangraham/2155274 to your computer and use it in GitHub Desktop.
prepend utf8 byte order mark (bom) and then rewrite file line by line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module UnfuckUnicode | |
| def byteordermarkify(old,new) | |
| File.open(new, 'w') do |out| | |
| out << "\xEF\xBB\xBF" | |
| File.foreach(old) do |line| | |
| out << line | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment