... From: Neil Bird To: Vim Mailing List Sent: Monday, August 01, 2005 2:51 PM Subject: File encoding question (UTF-16?)Message 1 of 3 , Aug 1, 2005View Source
----- Original Message -----
From: "Neil Bird" <neil@...>
To: "Vim Mailing List" <vim@...>
Sent: Monday, August 01, 2005 2:51 PM
Subject: File encoding question (UTF-16?)
> I think I asked this years ago, but I've lost & forgotten the answer!
> I have a file (previously on Win32, but this was on Linux IIRC - I've
> actually forgotten at this moment what it was!) that seems to have 16-bit
> wide chars: every character is actually preceded by a nul:
> hello -> ^@h^@e^@l^@l^@o
> Is there some combination of encoding/fileencoding/other can set to get
> it editable? I'm running natively UTF-8.
> [neil@fnx ~]# rm -f .signature
> [neil@fnx ~]# ls -l .signature
> ls: .signature: No such file or directory
> [neil@fnx ~]# exit
Your file is in little-endian UTF-16. With 'encoding' set to UTF-8, load
:e ++enc=utf-16le filename
If the first two bytes in the file are 0xFF 0xFE (the UTF-16le encoding
marker, also known as the BOM for "byte order mark"), then the encoding can
be recognised automatically if your 'fileencodings' start with ucs-bom
(i.e., with ":set fencs^=ucs-bom"). -- Normally, if your 'encoding' is set
to UTF-8, 'fileencodings' should be set to something like
"ucs-bom,utf-8,default" (for Vim 7) or "ucs-bom,utf-8,latin1" (for Vim6,
replace "latin1" by the 8-bit encoding you use most often).
especially the last paragraph
Around about 01/08/05 16:59, Tony Mechelynck typed ... ... Excellent, thanks for that! -- [neil@fnx ~]# rm -f .signature [neil@fnx ~]# ls -l .signature ls:Message 1 of 3 , Aug 1, 2005View SourceAround about 01/08/05 16:59, Tony Mechelynck typed ...
> :e ++enc=utf-16le filenameExcellent, thanks for that!
[neil@fnx ~]# rm -f .signature
[neil@fnx ~]# ls -l .signature
ls: .signature: No such file or directory
[neil@fnx ~]# exit