Encoding inconsistencies

Azra Aiyl azraiyl at gmail.com
Mon Jun 16 02:24:11 CDT 2008


> Now try running that through a pipe. Doh.

sys.stdout.encoding is None if you use a pipe therefore you can fallback to hg
default behaviour.

> Notepad. Doh. Etc. Windows is braindead enough that there is no right
> answer. There are only more or less insane answers. Mercurial's answer
> is to use the same encoding that GUI applications use as that's slightly
> more sane in the big picture than using the encoding that command-line
> applications use.

I will modify hg anyway so the people at the company I work don't have to
configure any file. (e.g. retrieve username, email automatically).
Therefore the
question is only if people are interested here in modifications in this
direction. e.g.

[ui]
editor2=myfavoriteeditor ; editor2 if backward compatibility is an issue
[editors]
myfavoriteeditor.executable=C:\in-this-directory\it-is.exe
myfavoriteeditor.encoding=utf-8
myfavoriteeditor.args=--anything $filename
notepad.executable=notepad.exe
;no encoding entry = the windows default encoding is choosen

If not, maybe at least the docs needs some updates so other people don't run
into the same problems. e.g. hg log can display umlauts correctly the bad thing
is I had to discover this by myself.

> Mercurial assumes its config files are in the local encoding, naturally.
> You need to use the HGENCODING environment variable to override that.

The encoding of the ini File is not changed. (Or maybe I dont understand what
you try to say to me)

Version 1 : default + "hg serve"
 -> correct Windows-1252 HTML output
Version 2 : default + "hg serve --encoding utf-8"
 -> correct UTF-8 HTML output
Version 3 : default + environment "HGENCODING=utf-8" + "hg serve"
 -> correct UTF-8 HTML output
Version 4 : default + "serve=--encoding utf-8" in defaults section + "hg serve"
 -> correct UTF-8 HTML output
Version 5 : default + "encoding=utf-8" in web section + "hg serve"
 -> wrong UTF-8 HTML output


What I forget to mention is that while hg log and hg serve can't display my
commits because I've commited them with a different encoding, HgTortoise can
decode all my commits (utf-8, cp850 and cp1252) correctly. Maybe there is too
much intelligence in gtk.


More information about the Mercurial mailing list