[PATCH 2 of 8] determine default locale encoding and stdio encoding on start-up
Matt Mackall
mpm at selenic.com
Mon Nov 20 18:20:30 UTC 2006
On Tue, Nov 21, 2006 at 12:05:28AM +0600, Andrey wrote:
> On 20 November 2006 (Mon) 23:36, Matt Mackall wrote:
> > I'm afraid this config approach doesn't really work.
> >
> > When you're likely to need to tweak this, you're like to need it to
> > have several settings. Consider:
> >
> > Laptop: runs modern all UTF-8 distro
> > Home machine: runs with a Russian character set
> > Work machine: runs with ASCII/Latin-1
> >
> > Now you can sit down at your desk at work with your laptop, and ssh
> > from both your laptop and your work machine back to your home machine
> > and suddenly things get complicated. If you override settings in
> > .hgrc, you'll break something on another machine. That's because
> > encoding is a property of the terminal session and not the machine it
> > happens to be running on.
>
> Exactly the same happens if you have some non-Latin file names or some of your
> programs emit non-Latin messages. I have to deal with that a lot and I just
> use a terminal emulator that does encoding conversion for me. I have also
> seen some wrapper scripts for ssh that do transparent encoding conversion. Or
> you can export LANG=<whatever you like> on remote machine. In fact, almost
> all *NIX programs are designed to output texts in locale encoding and never
> think of broken terminal encodings and other complex things, and so should
> we.
>
> > Which means this should all move out of ui and into util!
>
> Would be nice indeed, but I could not find a way to access config settings
> from util without explicitly passing an ui object to every function or some
> other unnecessary complications. Or you still want to get rid of that config
> options at all?
Did you not read my message? Config settings don't work because
they're attached to the machine and not the terminal. Instead, we need
environment variables. Thus, we don't need config access.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list