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 8 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.

Reference

I found the thread below, which I used as a source when this was answered. The original site is now gone (accessible in this answer's history), so I'm moving the contents of that thread here for posterity sake. The link was still in the Wayback Machine.

#1 Eli the Bearded January 21st, 2004 - 06:51 pm ET | Report spam
In comp.os.linux.misc, Leon. wrote:
Hide the quote
"Gaétan Martineau" wrote in message
news:E9jLb.2903$
> [ system_notes]$ vi installation_chouette.txt
> What means the [converted] at the bottom of the screen, as in:
> "installation_chouette.txt" [converted] 2576L, 113642C

It means that vim detected that the file did not match the
charset given by your locale and made a conversion. What does

:set

Tell you about "fileencoding" and "fileencodings"? The first is
the encoding used for the current file, the second is a comma
separated list of recognized encodings.

Hide the quote
> This file has accented characters. How can I save the file so that if I
> reload if again, I do not see "converted"?



Figure out what charset you want, and then

:set fileencoding=[charset]
:w

Hide the quote
It means deleting the Microsoft Dos/ Windows CR LF end of lines, to just
LF - unix standard end of lines.

It does not. If you open a file with DOS line ends, vim reports [dos]
after the filename, not [converted]. If you do have a dos file that
you wish to convert to unix line ends, you can

:set fileformat=unix
:w

Elijah
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.