On 21/04/09 21:07, David Fishburn wrote:
>
> I am finishing off some work getting Vim to work with Outlook.
>
> Things were looking good until I tried to edit a message from a
> Japanese co-worker.
>
> The basic flow is this:
> 1.  Open the message in Outlook.
> 2.  Hit a toolbar icon which fires some VB code.
> 3.  The VB code opens which takes the body of the message and writes
> it out to a file.
> 4.  Then uses Vim OLE object to edit it by sending the actual command
> you would type:
>           :e ++enc=utf-16 myfile.txt
>
> When we write out the file (from VB) we can tell it to create a unicode file.
>
> In VB, I can look up the code page of the email.
> It returns the last set of digits below, so for my Japanese email the
> following is returned by VB: 50220 so using the chart below, I see
> this line:
>       Japanese (JIS) iso-2022-jp 50220
>
> So, now that I have written out a unicode file, I am trying to open it in Vim.
> I can't figure out what the actual :e line is to open this file.
>
>           :e ++enc=utf-16 myfile.txt
>           :e ++enc=utf-8 myfile.txt
>
> Both leave the file unreadable in Vim (upside down question marks fill
> the screen).

Windows "Unicode" files are typically little-endian UTF-16, while in 
Vim, if you don't specify the endianness for 16- or 32-bit Unicode you 
get big-endian. So if I were you I'd try

        :e ++enc=utf-16le myfile.txt

If the file (as displayed in Vim) starts then with <feff>, it means that 
it has a BOM (Windows UTF-16 files often do), and in that case Vim will 
detect the encoding automatically provided that 'fileencodings' (plural) 
starts with ucs-bom (and, of course, that you don't force a specific 
encoding with ++enc). If that's the case,

        :e myfile.txt

would be enough (and Vim will remember that the file has a BOM by 
setting 'bomb' locally for that file).


Best regards,
Tony.
-- 
Ever notice that even the busiest people are never too busy to tell you
just how busy they are.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to