Thursday, December 3, 2009

Re: vim + win + utf-8 => I'm lost

On 03/12/09 09:35, Mojca Miklavec wrote:
> On Thu, Dec 3, 2009 at 09:22, Tony Mechelynck wrote:
>>
>> Well, is it possible to set the locale to UTF-8 on Windows the way it is on
>> Linux? My current locale ($LANG on Linux) is 'en_US.UTF-8'. Maybe you could
>> try setting the locale to 'Polish_Poland.UTF-8' or
>> 'Slovenian_Slovenia.UTF-8' (or some such) on your Windows system? Or does
>> that create other problems?
>
> Yes and no.
>
> No because it's not possible to set it to "Slovenian_Slovenia.UTF-8".
> Windows only seems to accept numerical values for encodings.
>
> Yes because it's possible to set the locale to
> "Slovenian_Slovenia.65001" where 65001 stands for UTF-8, but I guess
> that vim has no idea what number 65001 means. I have tried it, I have
> created menu translation menu_slovenian_slovenia.65001.vim which has
> been used (confirmed by modifying some strings in that translation),
> but vim didn't behave any differently.
>
> Mojca
>
> PS: the encoding in locale seems to be there just for "old application
> that don't understand unicode", so windows doesn't bother to set the
> locale to Unicode even if it's a a unicode system.
>
> PPS: Even if I would manage to force the encoding in Locate to be
> UTF-8, I guess that it still needs to be fixed in such a way that it
> will behave properly by default. (Some years ago I was getting Slovak
> translations by default on every computer which was a lot worse than
> not getting any tranlation at all.)
>

Getting all menus and messages in English regardless of the locale is
quite easy; all it takes is the following code snipped AT THE VERY TOP
of your vimrc (before setting up the menus, and before sourcing the
vimrc_example.vim if you source it):

if has('unix')
language messages C
else
language messages en
endif

If Vim doesn't understand what 65001 means, you could maybe (untested)
do something like

if v:ctype ~= '\<65001$' " if the locale ends in '65001' as a word
set enc=utf-8 tenc= " tell Vim that Windows wants UTF-8
endif

just before the point where you turn 'encoding' to UTF-8 if running in a
different locale.


Best regards,
Tony.
--
"I'm in Pittsburgh. Why am I here?"
-- Harold Urey, Nobel Laureate

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

No comments: