[PATCH 12 of 20] hgweb, paper: add shortlogajax template and use it

Martin Geisler martin at geisler.net
Tue Aug 20 10:27:02 CDT 2013


Antoine Pitrou <solipsis at pitrou.net> writes:

> Martin Geisler <martin <at> geisler.net> writes:
>> So a tooltip which shows the username, commit message, bookmarks and
>> branch names could be implemented. Showing the filenames for a commit
>> is more problematic since you cannot be sure that they can be JSON
>> encoded.
>
> How is it more problematic than representing them under HTML form? If
> you're saying hgweb can put undecodable byte sequences in its
> generated HTML, well this is ugly as hell ("mojibake").

I'm afraid that this is the situation -- like the rest of Mercurial,
hgweb is working on byte strings internally and wont hesitate to output
pages with mixed encodings.

Patches are an easy example: they're not transcoded when you view them
in hgweb, so unless HGENCODING matches the patch encoding, you'll have a
page with mojibake.

> What you're thinking of as a technical representation issue (i.e.
> encoding) is really a visual presentation issue. You want to present
> data to the user, but you don't know what the data means - since you
> refused to infer a character encoding when saving the filenames. Human
> beings can read text, they can't read bytestreams. If Mercurial loses
> information as to how to interpret a piece of data, then Mercurial has
> a problem - not necessarily JSON or XML ;-)

Yeah, it's no secret that I agree with that. Keeping everything as byte
strings internally removes the risk or getting UnicodeErrors at runtime,
but it also makes it difficult to reason about the data later.

Matt often talks about the Makefile problem (silently changing the
filename encoding without changing the Makefile encoding), but when I've
tried to reproduce the problem, I found non-ASCII filenames to be not
portable in the first place: Make could not find the files Mercurial
checked out with non-ASCII characters in their names.

The example repo is here:

  https://bitbucket.org/mg/makefile-problem/

and testing with Window 7 and GnuWin32 Make 3.81 still fails.

I've added a new commit there with the Makefile encoded in OEM 437
encoding, which make 'type Makefile' look correct in the Command Prompt.
But make fails with:

  make: *** No rule to make target ``ble.txt', needed by `p`re.txt'.

I don't know if there is an encoding that will let Make work with
non-ASCII characters on Windows?

-- 
Martin Geisler


More information about the Mercurial-devel mailing list