title: vim encodings: latin1 and utf-8
body: <p>Here's my problem:</p>
  
  <ul>
  <li><p>when I open the file, I get this message from vim: </p>
  
  <pre><code>"myfilename.sql" [converted] 78565L, 10487381C
  </code></pre></li>
  <li><p>if I do <code>:set</code> i get:</p>
  
  <pre><code>Options
    backspace=2         colorcolumn=+1      formatoptions=qc    scrolloff=15        smartindent         textwidth=80        visualbell
    backup              expandtab           ignorecase          shiftwidth=4        syntax=sql          ttyfast             t_vb=
    bomb                filetype=sql        number              showcmd             tabstop=4           ttymouse=sgr
    backupdir=~/.vim/backup
    comments=s1:/*,mb:*,ex:*/,:--,://
    define=\c\&lt;\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\&gt;
    directory=~/.vim/tmp
    fileencoding=utf-8
    fileencodings=utf-8,ucs-bom,default,latin1
    matchpairs=(:),{:},[:],&lt;:&gt;
    omnifunc=sqlcomplete#Complete
    viminfo='10,"100,:20,%,n~/.viminfo
  </code></pre></li>
  <li><p>I have the characters visible like this:</p>
  
  <p><img src="https://i.stack.imgur.com/eqrwQ.jpg" alt="vim bad encoding"></p></li>
  <li><p>I found that if I reload &amp; force encoding latin1 with <code>:e ++enc=latin1</code> I get right accents, but <em>not all</em>:</p>
  
  <p><img src="https://i.stack.imgur.com/GPn5t.jpg" alt="vim almost good encoding"></p></li>
  <li><p>So I found out (the only solution) to get all the right visible encoding is to manually force back to utf8: <code>:set encoding=utf8</code> then I get:</p>
  
  <p><img src="https://i.stack.imgur.com/ZnlMV.jpg" alt="vim good encoding"></p></li>
  <li><p>if I do <code>:set</code> i get:</p>
  
  <pre><code>--- Options ---
    backspace=2         encoding=utf-8      formatoptions=qc    scrolloff=15        smartindent         textwidth=80        visualbell
    backup              expandtab           ignorecase          shiftwidth=4        syntax=sql          ttyfast             t_vb=
    colorcolumn=+1      filetype=sql        number              showcmd             tabstop=4           ttymouse=sgr
    backupdir=~/.vim/backup
    comments=s1:/*,mb:*,ex:*/,:--,://
    define=\c\&lt;\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\&gt;
    directory=~/.vim/tmp
    fileencoding=latin1
    fileencodings=utf-8,ucs-bom,default,latin1
    matchpairs=(:),{:},[:],&lt;:&gt;
    omnifunc=sqlcomplete#Complete
    viminfo='10,"100,:20,%,n~/.viminfo
  </code></pre></li>
  <li><p>As you can see, I see <code>fileencoding=latin1</code> so I try to force it to utf8: <code>:set fileencoding=utf-8</code>. I save it <code>:wq</code> and whenever I want to re-open it nothing has changed, <em>I still have to do all of this to get a proprer display</em> with good accents!</p></li>
  <li><p>The only thing I want from now is to save it so that I can re-open it without having all of this to do to get it right. What should I do?</p></li>
  </ul>