Ken Takata wrote:

> I can't input multibyte characters on Win32 console if 'encoding' is
> different from current codepage. (e.g. :set enc=utf-8 tenc=cp932)
> The encoding of typed characters is not properly converted from
> 'termencoding' to 'encoding'.
> 
> There are two problems in the current implementation.
> 
> 1. mch_inchar() in os_win32.c uses convert_input() to convert typed 
> characters,
>    but convert_input() discards the input if it is incomplete.
>    convert_input_safe() should be used instead of convert_input().
> 2. string_convert_ext() in mbyte.c does not return an error even if the input
>    is incomplete (e.g. only a leading byte of multibyte character is 
> contained)
>    when CONV_CODEPAGE is used.
> 
> Attached patch fixes these problem.
> For the first problem, mch_inchar() uses convert_input_safe() as
> fill_input_buf() in ui.c.
> For the second problem, MB_ERR_INVALID_CHARS flag is specified for
> MultiByteToWideChar() to detect incomplete inputs if string_convert_ext()
> is called from convert_input_safe().

Great that you could make this work.  I'll add it to the todo list
(which is getting very long, unfortunately...).


-- 
   [Another hideous roar.]
BEDEVERE: That's it!
ARTHUR:   What?
BEDEVERE: It's The Legendary Black Beast of Aaaaarrrrrrggghhh!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui