Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a log file, and when I open it via vim, it looks not readable, and it has [converted] at the bottom. What does [converted] mean?

Is there a way to fix the format issue so that it is human readable?

share|improve this question
    
There is no guarantee that a log file is humanly readable. At least some of the files in /var/log/ are not. Which program did make the log file? What is its file name? –  Anthon Apr 24 at 4:16
    
@Anthon The original log looks good, but after the log rotation by daemontools, it is no longer human readable. –  Mingyu Apr 24 at 13:06
    
Did it get compressed by the rotation. Did you run the file command on the file? –  Anthon Apr 24 at 13:38
    
@Anthon The file type is data. What does that mean? –  Mingyu Apr 24 at 13:58
    
Essentially that the file command does not recognize the type with further accuracy, or that entries are missing in the magic rules. –  Anthon Apr 24 at 14:04

3 Answers 3

up vote 4 down vote accepted

It means that vim detected that the file did not match the charset given by your locale and made a conversion. If you run the command :set from within vim:

:set
--- Options ---
  autoindent          fileformat=dos      scroll=7            textwidth=70
  background=dark     filetype=asciidoc   shiftwidth=2        ttyfast
  cscopetag           helplang=en         softtabstop=2       ttymouse=sgr
  cscopeverbose       hlsearch            syntax=asciidoc
noendofline           list                tabpagemax=3
  expandtab           ruler               textmode
  backspace=indent,eol,start
  comments=s1:/*,ex:*/,://,b:#,:%,:XCOMM,fb:-,fb:*,fb:+,fb:.,fb:>
  cscopeprg=/usr/bin/cscope
  fileencoding=utf-8
  fileencodings=ucs-bom,utf-8,latin1

Notice the last 2 options, fileencoding & fileencodings.

The first is the encoding used for the current file, the second is a comma separated list of recognized encodings.

So when you see that message vim is telling you that it's completed converting the file from fileencoding to encoding.

Check out :help fileencoding or :help encoding for additional details.

References

share|improve this answer

In vim command mode, type:

:help read-messages

You can see:

[converted]      conversion from 'fileencoding' to
                 'encoding' done

In general, it means that vim detected the file did not match the charset given by your locale and made a conversion.

To see more details, try :help fileencoding, :help fileencodings.

share|improve this answer

It means that the file-on-disk does not use the same charset as Vim's memory area, and that the conversion from one to the other was successful. Press escape key and type this command.

:set fileformat=unix

Save the file and try reading again.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.