[PATCH 2 of 8] determine default locale encoding and stdio encoding on start-up

Andrey grooz-work at gorodok.net
Mon Nov 20 18:05:28 UTC 2006


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?

Andrey



More information about the Mercurial-devel mailing list