[darcs-devel] [issue1693] Check displaying of Unicode patch metadata

Ganesh Sittampalam bugs at darcs.net
Mon Dec 8 19:20:23 UTC 2014


Ganesh Sittampalam <ganesh at earth.li> added the comment:

I've spent some time looking at this and sent draft patch1239

I don't really like it as it's a layer of sticking plaster on top of an already messy 
situation. It also doesn't make the situation any better on Windows or in non-UTF8 
locales, though I don't think it makes it any worse.

The patch basically adds a new parameter to all the printing code to decide whether to 
locale-encode Strings as they are output or not. Bytestrings are left alone as they 
typically seem to be sourced from patch metadata which is already UTF8-encoded.

I don't think we can do this translation unconditionally because the same code is used 
to print out patch files on disk etc. It seems to me that the right long-term solution 
would be to use phantom types to tag both Strings and Bytestrings with their encoding 
(e.g. locale, UTF8, 7bit-only). This would make it clear where in the code we should 
convert things. We should also cleanly split out the "print for user consumption" and 
"print for persistence" use cases; they're currently tangled together all the way up 
to classes like ShowPatch.

Users will also need to set the environment variable DARCS_DONT_ESCAPE_8BIT=1 to get 
UTF8 output. It feels like we should make that the default, but I don't fully 
understand the implications and why it isn't already the default.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1693>
__________________________________


More information about the darcs-devel mailing list