[darcs-devel] Re: [darcs-users] Can I disable \xx quoting in record --interactive?

Tommy Pettersson ptp at lysator.liu.se
Sat Mar 19 18:50:17 PST 2005


On Sat, Mar 19, 2005 at 05:42:59PM -0800, Junio C Hamano wrote:
> Is there a way to disable hexadecimal \xx quoting when "darcs
> record" shows each hunk for selection?  Some files I maintain
> in my darcs repository are in EUC-JP encoding, which contains

No (probably not).

Darcs escapes all non-ascii to protect from evil patches that
spoof the terminal by inserting control characters.

If the locale is a single-byte encoding you can set the
environment variable DARCS_USE_ISPRINT to 1.  Then darcs will
use the library function isprint() to decide what characters
are safe to print.

I know nothing about EUC-JP, but I think it's a multi-byte
encoding.  Darcs checks the bytes one by one.  If the encoding
is made in a way so that it is possible to decide for each
byte individually if the combined character is printable,
and if the library function isprint() supports it, it will
work with DARCS_USE_ISPRINT.


(Next paragraph got a bit more into developing darcs than I
first intended, but I'm leaving it and cc-ing darcs-devel.)

I use latin1 and utf8, of which utf8 is a multi-byte encoding
that doesn't work with DARCS_USE_ISPRINT.  So I'm inclined to
fix it.  The DARCS_USE_ISPRINT was an easy work-around I made.
To fix the i18n problem for real is not so easy.  Maybe it
can be done by only supporting utf8 in darcs, and have filter
hooks to convert output to utf8 before it is decorated for
the terminal, and back to the locale after it is decorated.
Plain ascii is identity in utf8, so the two special cases
ascii and utf8 would just work (without filtering), which
would cover a considerable part of the past and the future.
In this many-encodings mean time, external filters can take
care of performing secure conversions (and take the blame if
they don't).


-- 
Tommy Pettersson <ptp at lysator.liu.se>




More information about the darcs-devel mailing list