David Fishburn wrote:
> From Visual Basic code we are using CreateTextFile() with the
> unicode flag turned on.
>
> This apparently writes out a file in unicode.
>
> We want to open this file in Vim, but can't really figure out
> what settings and command lines to use to successfully open
> the file.
>
> I am having a hard time with Google and Microsoft trying to
> determine when CreateTextFile() is used, what type of encoding
> is used on the file. I believe it has a BOMB and it might be
> utf-16.
>
> Assuming this, I thought the following would be enough for Vim
> to open the file successfully:
> :set fileencodings=utf-8,ucs_bom,utf-16
> :e ++enc=utf-16 myfile
I have not tried the above, but exporting a registry file on
older Windows systems writes in an encoding where the above
(++enc=utf-16) does not work. The correct command is:
:e ++enc=utf-16le myfile
If your script runs Vim, it may be possible to use the -cmd
option to set the correct encoding (although for all I know it
would vary depending on Windows version!?).
My experience is that fiddling with fileencodings is generally
NOT satisfactory, and the default setting on Windows works fine
(I think you need the BOM first). The first two lines of the
_vimrc file should be:
set nocompatible
set encoding=utf-8
and do NOT set fileencodings. The Unicode default will then
apply, namely:
:set fileencodings=ucs-bom,utf-8,default,latin1
John
--
--
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/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment