Loading ...
Sorry, an error occurred while loading the content.

Re: UFT-8/16 help needed (How to set up Outlook 2010 / Vim 7.3 to have OutlookVim with Unicode (UTF-8) support?)

Expand Messages
  • David Fishburn
    ... Background: 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
    Message 1 of 4 , Apr 8, 2013
    • 0 Attachment



      On Mon, Apr 8, 2013 at 10:31 AM, <aswna2010@...> wrote:
      Hi David
      > Assuming all was good, save the file.
      Yes, it was successful.

      I have sourced the following .vim\after\ftplugin\mail.vim:
      set bomb
      set encoding=utf-8
      set fileencoding=utf-8
      set termencoding=utf-8

      The hexdump results of the two-character long mail body of "őű".
      1. Copy-paste (from Outlook to Vim).
      0000000 bbef c5bf c591 0db1 000a
      0000009

      2. Using the macro as it is.
      0000000 bbef 6fbf 0a75
      0000006

      3. Modified the macro to force unicode (utf-16).
      0000000 bbef efbf bebf 84e5 e781 8184 a8e0 0d80
      0000010 000a
      0000011

      4. Modified the macro the force unicode (utf-8).
      0000000 bbef 3fbf 513f 7101 0a01 0a00
      000000c

      Here I called "force unicode": commented line 201 in the macro, where unicode variable is set to False.


      I think we need a bit of help from the multi_byte community.

      Background:

      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

      If you look at the HEX above, does it help anyone?

      Thank you.
      David

      --
      --
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
       
       
    • John Beckett
      ... I have not tried the above, but exporting a registry file on older Windows systems writes in an encoding where the above ... If your script runs Vim, it
      Message 2 of 4 , Apr 8, 2013
      • 0 Attachment
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • aswna2010@...
        Hi John, thanks for your suggestions. (I am struggling with the original issue.) ... I also set a Unicode capable font (I have tried DejaVu_Sans_Mono and
        Message 3 of 4 , Apr 9, 2013
        • 0 Attachment
          Hi John,
          thanks for your suggestions. (I am struggling with the original issue.)
          I have tried the things you mentioned, set only the following in my .vimrc:
          > set nocompatible
          > set encoding=utf-8
          I also set a Unicode capable font (I have tried DejaVu_Sans_Mono and Consolas, too).

          I have the default you mentioned:
          > :set fileencodings=ucs-bom,utf-8,default,latin1

          Then I tried to open the (original) snippets I saved the other day (hexdumps shown earlier).
          1. Copy-paste (from Outlook to Vim) works perfectly. No ++enc is needed.
          For the others I have tried what you suggested:
          > :e ++enc=utf-16le myfile
          also tried "++enc=utf-16" and "++enc=utf-8". I have no luck, none of the other 3 files could be displayed correctly.
          Partial success for the 4., which should be in utf-8, and when I use the "++enc=utf-16" at open, then I can see one of the two characters (ű) correctly.
          I have also tried to open the same files on Linux, unfortunately I got the same results.

          / András

          --
          --
          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • aswna2010@...
          I have experimented some more with the plugin in question (OutlookVim) and I could make it work. At least for me it seems to be fine, the hexdump is also
          Message 4 of 4 , Apr 9, 2013
          • 0 Attachment
            I have experimented some more with the plugin in question (OutlookVim) and I could make it work. At least for me it seems to be fine, the hexdump is also correct using the plugin.
            0000000 feff 0151 0171 000a
            0000008

            The solution was to specify explicitly "utf-16le" (not simply "utf-16") in the plugin, when writing out the file. More details in "How to set up Outlook 2010 / Vim 7.3 to have OutlookVim with Unicode (UTF-8) support?".

            Thanks,
            András

            --
            --
            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@....
            For more options, visit https://groups.google.com/groups/opt_out.
          Your message has been successfully submitted and would be delivered to recipients shortly.