Archive

Archive for the ‘Vim’ Category

UTF-8 and byte order mark

4 March 2011 Leave a comment

Problem

You have a text file with non-ASCII characters that you want to view within a web browser. But the browser jumbles up all those character accents, etc. How do you fix this?

Solution

With Vim, you can use bomb. But I just use Bash to prepend a text file with the relevant hex characters:

$ echo -n -e "\0357\0273\0277" | cat - myfile.txt > /tmp/myfile.tmp && mv /tmp/myfile.tmp myfile.txt

I wish it could be as easy and dramatic as letting the Bomberman take care of the above problem 🙂

Categories: documentation, Vim Tags: , ,