I have fileencodings=ucs-bom,utf-8,latin1. But I would like to use latin2 instead of latin1 for files that contain the characters 0xf5 or 0xfb (ő and ű in latin2).
I tried to modify the example that is given on the help page for 'fileencodings', like this: au BufReadPost * if &fenc == "latin1" && search('\%xfb\|\%xf5', 'w') > 0 | exe ":e ++enc=latin2" | endif This seems to work, but the syntax highlighting gets turned off for latin2 encoded files. Could someone explain why this happens? How can I avoid this? It would be even better if someone could give a solution which also works for reading files with :r, not just :e. Thanks for your replies in advance, Szabolcs