Sunday, April 7, 2013

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


On Sat, Apr 6, 2013 at 2:02 PM, <aswna2010@gmail.com> wrote:
...
 
I have recently installed the OutlookVim Vim plugin (https://github.com/vim-scripts/OutlookVim, version 8.0). I have MS Windows 7 Enterprise SP1 (64-bit OS) and Vim 7.3.46 (ftp://ftp.vim.org/pub/vim/pc/gvim73_46.exe).

Basically, I would like to edit mails, which contain characters from the Hungarian alphabet (see below). Above setup does not seem to work out of the box for this purpose.

...
 
The issue (example): in Outlook I can enter and see the above characters correctly, but when I click on the Vim.Edit macro, which opens the text in Vim, above characters show up as 'o' and 'u'. :( When I save the buffer and gets back to Outlook the text is already got the wrong letters.

I have also experimented with setting utf-8 encoding/fileencoding for the "mail" filetype, no luck. Also tried to hack the Vim.Edit macro, no success.

I am glad you are trying the multibyte support, I added it to OutlookVim, but have never had a chance to use it.

There are a few things that are required for Vim to support multibyte characters.
NOTE: I do not use multibyte support in Vim, so if anyone else wants to chime in that would be terrific.

The OutlookVim.bas file checks a few things in Vim:

1.  Does your Vim support multibyte (test with :echo has("multi_byte") )?
2.  Is a BOMB enabled (:set bomb, tested with :echo &bomb == 1)
3.  Does the fileencodings support UTF8 ( tested with :echo match(&fileencodings, '\<ucs-bom\|utf\>')   )?


If so, it will enable unicode format in the file which Outlook writes for Vim to edit.


So, you can do this simple test.
1.  Start Vim
2.  :set bomb
3.  :set filecodings=utf-8
4.  :set encoding=utf-8
5.  Make sure the guifont you are using supports the character sets you are displaying.
6.  From Outlook, hit the Edit in Vim button again and see what happens.



I have the following in my .vimrc when I want to play with multibyte:

if has("gui_running")
    if has("multi_byte")
        set encoding=utf-8
        setglobal fileencoding=utf-8
        set bomb
        set termencoding=iso-8859-15
        set fileencodings=iso-8859-15,iso-8859-3,ucs-bom,utf-8,utf-16

        " Enable Unicode (for Chinese and so on)
        " Downloaded from here: http://sourceforge.net/projects/dejavu/
        if filereadable(expand('$SystemRoot').'/fonts/DejaVuSansMono.ttf')
            " If running on drastically different resolution monitors
            " this will set the font based which screen you are
            " currently on.  This assumes the monitor above you has
            " a higher resolution.
            let fontsize = (getwinposx()<0 ? '11' : '11')
            " For normal 11 point font
            "   set guifont=Bitstream_Vera_Sans_Mono:h11:cANSI
            " For bold 11 point font
            " echomsg 'fontsize:'.fontsize.'  posx:'.getwinposx()
            exec 'set guifont=DejaVu_Sans_Mono:h'.fontsize.':cANSI'
        endif
    else
        echoerr "Sorry, this version of (g)vim was not compiled with +multi_byte"
    endif
else
    echoerr "console Vim will not display UTF-8 properly"
endif
 

HTH,
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@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: