sed 's/^i/o/;H;1h;$!d;x;q' <infile >>infile
If the file is small enough to fit into memory, then the above should work. I can't think of any reason you might have an encoding problem unless your sed is buggy. A sane sed should handle any valid character encoding you might care to throw at it.