Mike Li wrote:
one more update: if i add the following two lines to my _vimrc, then
the ucs-2le text file works:

set fileencodings+=ucs-2le
set encoding=utf-8

note that both need to be set before i edit the file. once i load the
file, setting them no longer helps.

-x

Of course:
- Vim needs to be able to represent Unicode codepoints in memory (":set encoding=utf-8"). This must be done before any attempt to read the file.

- Vim needs to know how to detect the encoding. This can be done in several 
ways:

* if 'fileencodings' *begins* with "ucs-bom", any Unicode encoding with BOM will be recognised. * if you use ":e ++enc=ucs-2be filename", the file will be interpreted according to big-endian UCS-2 * if 'fileencodings' contains "ucs-2le", and anything preceding it checks "invalid" for that file, then the file will be read as little-endian UCS-2 if it contains no invalid bytes for that encoding.

Of course, if you change 'fileencodings' after the file has been read, it is too late.

You also need to set a font containing the glyphs for whatever codepoints you'll want to see. This is not a trivial problem in multilingual file: e.g., I know no fixed-width font having both Chinese and Arabic glyphs. Setting the font is done in gvim by means of the 'guifont' option; console Vim uses whatever font is set by the hardware text console or by the software terminal emulator.

See:
        :help 'encoding'
        :help 'fileencodings'
        :help ++opt
        :help mbyte.txt
        :help 'guifont'

Best regards,
Tony.
--
Did you know that there are 71.9 acres of nipple tissue in the U.S.?

Reply via email to