Monday, October 4, 2021

Re: opening utf-16 fileencoded ucs-2 Little Endian

Hum I see Jürgen. Thank you.

Le lun. 4 oct. 2021 à 13:24, 'Jürgen Krämer' via vim_use <vim_use@googlegroups.com> a écrit :
Hi,

Christian Brabandt schrieb am 04.10.2021 um 12:44:
>
> On Mo, 04 Okt 2021, Ni Va wrote:
>
>> No error message but I don't happen to read the file.
>
> And you did use ':e! ++enc=utf16le' for the already loaded file? Because
> with this exact same command, I can reload the loaded file perfectly.
>
> Alternatively, try to add utf16le to the (global) fileencodings
> settings. But you need to add it before utf-8 I believe. So this should
> also work:
>
> ':set fencs=ucs-bom,utf16le,utf-8,latin9'
>
> But I am not sure, if this will not break for utf-8 files, so I tend to
> only explicitly re-load files using the `:e ++enc ` command

this will probably break utf-8 files without BOM. With BOM they would be
correctly detected by ucs-bom. Without a BOM all or almost all utf-8 files
can be interpreted as utf-16 -- even those with an odd number of bytes; in
this case Vim puts out a conversion error, but loads the file anyway. Even
incomplete surrogate pairs don't seem to prevent Vim from loading the file
as utf-16.

Better put utf16le after utf-8, because a misinterpretation of utf16 (both
little endian and big endian) can be detected by Vim.

But then you will probably run into the same dilemma with utf-16 and
latin9 ... :-(

Regards,
Jürgen

--
~
~
~
:wq

--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/92aX9rHFCeE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/6282c4d4-9137-5a70-bea5-ea1a7a818216%40googlemail.com.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAOKxv4E89CaiG%3DmN1U9xDy8COd6CbZaSJPK9Tcnv-kGgO_7mEQ%40mail.gmail.com.

No comments:

Post a Comment