Re: [PATCH] contrib/diff-highlight: multibyte characters diff

2014-02-13 Thread Yoshihiro Sugi
Thanks for reviewing. as you wrote, diff content may not be utf8 at all. and we don't know that the user's terminal watns is utf8. I think your trying utf8 decode and fall back approach is better than my patch, and do work well. is using "$@" for catching error like the patch below? According to

Re: [PATCH] contrib/diff-highlight: multibyte characters diff

2014-02-12 Thread Jeff King
On Thu, Feb 13, 2014 at 01:17:54AM +, brian m. carlson wrote: > On Wed, Feb 12, 2014 at 06:27:40PM -0500, Jeff King wrote: > > On Wed, Feb 12, 2014 at 11:10:49PM +, Thomas Adam wrote: > > > > > On 12 February 2014 20:59, Jeff King wrote: > > > > +sub decode { > > > > + my $orig = s

Re: [PATCH] contrib/diff-highlight: multibyte characters diff

2014-02-12 Thread brian m. carlson
On Wed, Feb 12, 2014 at 06:27:40PM -0500, Jeff King wrote: > On Wed, Feb 12, 2014 at 11:10:49PM +, Thomas Adam wrote: > > > On 12 February 2014 20:59, Jeff King wrote: > > > +sub decode { > > > + my $orig = shift; > > > + my $decoded = eval { decode_utf8($orig, Encode::FB_CROAK) }

Re: [PATCH] contrib/diff-highlight: multibyte characters diff

2014-02-12 Thread Jeff King
On Wed, Feb 12, 2014 at 11:10:49PM +, Thomas Adam wrote: > On 12 February 2014 20:59, Jeff King wrote: > > +sub decode { > > + my $orig = shift; > > + my $decoded = eval { decode_utf8($orig, Encode::FB_CROAK) }; > > + return defined $decoded ? > > I'd still advocate checkin

Re: [PATCH] contrib/diff-highlight: multibyte characters diff

2014-02-12 Thread Thomas Adam
On 12 February 2014 20:59, Jeff King wrote: > +sub decode { > + my $orig = shift; > + my $decoded = eval { decode_utf8($orig, Encode::FB_CROAK) }; > + return defined $decoded ? I'd still advocate checking $@ here, rather than the defined $decoded check. > + ($decod

Re: [PATCH] contrib/diff-highlight: multibyte characters diff

2014-02-12 Thread Jeff King
On Tue, Feb 11, 2014 at 06:09:10PM +0900, Yoshihiro Sugi wrote: > diff-highlight split each hunks and compare them as byte sequences. > it causes problems when diff hunks include multibyte characters. > This change enable to work on such cases by decoding inputs and encoding > output as utf8 stri

Re: [PATCH] contrib/diff-highlight: multibyte characters diff

2014-02-11 Thread Junio C Hamano
Yoshihiro Sugi writes: > Signed-off-by: Yoshihiro Sugi > > diff-highlight split each hunks and compare them as byte sequences. > it causes problems when diff hunks include multibyte characters. > This change enable to work on such cases by decoding inputs and encoding > output as utf8 string. >

[PATCH] contrib/diff-highlight: multibyte characters diff

2014-02-11 Thread Yoshihiro Sugi
Signed-off-by: Yoshihiro Sugi diff-highlight split each hunks and compare them as byte sequences. it causes problems when diff hunks include multibyte characters. This change enable to work on such cases by decoding inputs and encoding output as utf8 string. --- contrib/diff-highlight/diff-high