I often use the
less pager to view logfiles. Usually I use
less -F to follow the progress of the log à la
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
The only solutions I found:
- Correct the encoding of the file (
iconv). This does not work while the file is still being written, so does not let me use
less -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 then
less -Fdoes not appear to work (it just does not update; I believe the
recodeprocess exits once it's done).
Any solution that lets me "tail" a logfile and still shows national characters correctly?