I often use the less pager to view logfiles. Usually I use less -F to follow the progress of the log à la tail.
However, some logfiles use national characters in a non-standard encoding (Latin-1, while the system uses UTF-8). Obviously, these will not be displayed correctly.
How can I view such files with less?
The only solutions I found:
- Correct the encoding of the file (
recodeoriconv). This does not work while the file is still being written, so does not let me useless -F. Plus it destroys the logfiles original timestamp, which is bad from an auditing perspective. - Use a pipe (
recode latin1... |less). Works for files in progress, but unfortunately thenless -Fdoes not appear to work (it just does not update; I believe therecodeprocess exits once it's done).
Any solution that lets me "tail" a logfile and still shows national characters correctly?