Thomas Rast <tr...@student.ethz.ch> writes:

> It would prevent spaces from being decoded correctly if the encoding
> program chooses to make the '_'.  git-format-patch does not actually do
> this, see the big comment around pretty.c:304.
>
> I think this patch would be a better match for what RFC2047 specifies.
> On the one hand it avoids substituting _ outside of encodings, but OTOH
> it also handles more than one encoded-word.

Yeah, I think it is an improvement.

I however wonder if the captured pattern for $2 should be minimized
with ? at the end, i.e. "..\?q\?(.*?)\?="?

> It still does not handle
> the case where there are several encoded-words of *different* encodings,
> but who would do such a crazy thing?

Even if somebody did so, it wouldn't have worked, and to make it
work, the sub and its caller (there is only one caller that actually
cares what the original encoding was) needs to be rethought anyway,
so I do not think it matters.

It may deserve an in-code NEEDSWORK comment, though.

Thanks.

> diff --git i/git-send-email.perl w/git-send-email.perl
> index ef30c55..88c4758 100755
> --- i/git-send-email.perl
> +++ w/git-send-email.perl
> @@ -862,11 +862,13 @@ sub make_message_id {
>  sub unquote_rfc2047 {
>       local ($_) = @_;
>       my $encoding;
> -     if (s/=\?([^?]+)\?q\?(.*)\?=/$2/g) {
> +     s{=\?([^?]+)\?q\?(.*)\?=}{
>               $encoding = $1;
> -             s/_/ /g;
> -             s/=([0-9A-F]{2})/chr(hex($1))/eg;
> -     }
> +             my $e = $2;
> +             $e =~ s/_/ /g;
> +             $e =~ s/=([0-9A-F]{2})/chr(hex($1))/eg;
> +             $e;
> +     }eg;
>       return wantarray ? ($_, $encoding) : $_;
>  }
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to