bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wrong codepage used by gettext


From: Bram Moolenaar
Subject: Re: wrong codepage used by gettext
Date: Wed, 28 Apr 2004 16:57:58 +0200

Bruno -

> vr wrote:
> > the workaround you suggested works, but it breaks certain programs.
> >
> > You see, in Vim, using cp1251 messages: we get all the messages just
> > fine, the only problem is with output that goes directly to console
> > window, such as doing vim --version or setting console window title.
> > After setting OUTPUT_CHARSET
> > to CP866 it gets just the other way around: window title and vim --help is
> > fine, but l18n of messages inside Vim gets broken. Can there be a
> > better solution?
> 
> We had a similar problem on HP-UX 10 years ago: the console window was using
> HP-ROMAN8 but all other X11 applications used ISO-8859-1. There was no
> solution (except to dump the HP machine and buy a Linux PC).
> 
> For vim, I can see two solutions:
> 
> a) vim knows for what purpose it will use each string, and sets the
> environment variable OUTPUT_CHARSET before calling gettext(). (There is
> a Woe32 specific caveat here; see
> http://www.haible.de/bruno/gettext-FAQ.html#windows_setenv)
> 
> Or equivalently, vim distributes each .mo file in two copies, say,
> vim_gui.mo and vim_console.mo, uses dcgettext to access them, and uses
> bind_textdomain_codeset("vim_console", "CP866").
> 
> b) Let a low-level I/O layer take care of it. GNU clisp does it this way;
> look at the ANSI2OEM_table transformation in the function write_helper in
> http://cvs.sourceforge.net/viewcvs.py/clisp/clisp/src/win32aux.d?rev=1.36&view=text

The problem is not so much that it can't be solved in some way, but that
the default codepage that gettext is using is wrong.  This means the
invoking program must know all the details and tricks to get it right.
It would be a lot simpler of gettext uses the right default.  Using
GetACP() and/or GetConsoleOutputCP() seems appropriate.

The messages in Vim work fine, only the "vim --version" output goes
wrong, because it's written to stdout directly, not with the internal
functions that take care of encoding conversion.  Changing that is
complicated, the startup sequence is long and includes a lot of system
dependencies.

I haven't been able to reproduce it myself yet.  I can't find a way to
set the output codepage of the console with a standard program.  "chcp"
apparently only sets the input.

- Bram

-- 
hundred-and-one symptoms of being an internet addict:
39. You move into a new house and decide to Netscape before you landscape.

 /// Bram Moolenaar -- address@hidden -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///




reply via email to

[Prev in Thread] Current Thread [Next in Thread]