Wednesday, December 28, 2011

Re: :language command

On 27/12/11 18:22, Axel Bender wrote:
> Why isn't it possible (in Windows?) to use :lanugage to set the language
> to e.g. ge-GE.UTF-8 (while ge-GE.1252 would work)?

Because Windows does not support non-numeric "code pages". This is, I
think, contrary to the ISO standard, but Microsoft never cared about
portability and standards if it could avoid them.

When I still had a double-boot system, my vimrc started with

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

because setting the language to "C" (guaranteed to be valid on any POSIX
system) would give an error under Windows, while setting it to "en"
would give an error under Linux. (On that Windows system, the system
locale was "French_Belgium.1252" and I wanted Vim messages in English.)

I have been told that the "Unicode code page" on Windows is 10646 but I
never had the occasion to test this hands-on, and it might mean UTF-16le
rather than UTF-8. (It doesn't make much of a difference to Vim, which
uses UTF-8 internally if you set 'encoding' to any recognized endianness
variant of UTF-16 or UTF-32.)

Here's what the help says:

> The locale {name} must be a valid locale on your
> system. Some systems accept aliases like "en" or
> "en_US", but some only accept the full specification
> like "en_US.ISO_8859-1". On Unix systems you can use
> the this command to see what locales are supported: >
> :!locale -a

clearly mentioning that it's a platform-dependent or system-dependent
setting.


>
> How - for that matter - does :language relate to the 'encoding' setting?

IIUC, $LC_CTYPE is what Vim uses to set the initial value of 'encoding'
at program startup, before sourcing the vimrc. On Windows there may be a
prior step, defining the various $LC_ variables from the locale settings
found somewhere on Windows, probably in the Windows registry. But after
that initial setup, once Vim starts sourcing the system vimrc then the
user vimrc, 'encoding' and v:ctype go their separate ways — unless,
maybe, you set 'encoding' back to its default by means of ":set enc&"
(NOT recommended).


Best regards,
Tony.
--
"I have the simplest tastes. I am always satisfied with the best."
-- Oscar Wilde

--
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

No comments: