Marcus Kracht: Linux TricksThis page is a selection of issues that I have come across and which may or may not be a problem for others.
:%!xxd; to convert back, use
:%!xxd-r). The character
öhas the HEX code
c3b6if set to Unicode UTF-8, but
f6if set to Latin1. This is to say, among other things, that in Latin1 it spans one byte, in UTF-8 two bytes. Once you know that you can detect which encoding you have. Look at the HEX converted file and look for a known character such as
öand see how it is encoded. Second step: suppose that your file is in Latin1, how do you get UTF-8? Here is the trick in Unix: type
iconv -t utf8 -f laint1 --output DESTINATION SOURCE