Wednesday, January 27, 2016

Re: editing a _corrupted_ CP1252 file

On 26.01.16 13:11, Kenneth Reid Beesley wrote:
> Here's my usual .gvimrc setup for encodings:
>
> " encoding used internally in the edit buffer
> set encoding=utf-8
>
> " default encoding for saving any new files created
> setglobal fileencoding=utf-8
>
> " when editing an existing file, try to read it in these encodings, use the first that succeeds
> set fileencodings=ucs-bom,utf-8,latin1

It doesn't seem all that complicated. A quick test on a "simulated
corrupted CP1252" file like yours both displayed <81>, and 8g8 worked
here without any fiddling at all. I have:

set encoding=utf-8 " Is default anyway, IIRC.

fileencodings=ucs-bom,utf-8,default,latin1

which seems to have latched on: fileencoding=latin1
given the input file.

That seems to confirm what ":h 8g8" says:

This works in two situations:
1. when 'encoding' is any 8-bit encoding
2. when 'encoding' is "utf-8" and 'fileencoding' is any 8-bit encoding

And I don't even have any "++bad=keep" anywhere.

Erik

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: