Re: [BUG] encoding problem with format-patch + send-email

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jeff,

>  sub unquote_rfc2047 {
>  	local ($_) = @_;
> -	if (s/=\?utf-8\?q\?(.*)\?=/$1/g) {
> +	my $encoding;
> +	if (s/=\?([^?]+)\?q\?(.*)\?=/$2/g) {
> +		$encoding = $1;
>  		s/_/ /g;
>  		s/=([0-9A-F]{2})/chr(hex($1))/eg;
>  	}
> -	return "$_";
> +	return wantarray ? ($_, $encoding) : $_;
>  }
I don't know perl very well, but that wantarray seems hacky.  (Something
in my head wants to have it always return ($_, $encoding) and fix all
callers. :-)

>  [...]
> @@ -756,6 +769,21 @@ foreach my $t (@files) {
>  
>  	if (defined $author) {
>  		$message = "From: $author\n\n$message";
> +		if (defined $author_encoding) {
> +			if ($has_content_type) {
> +				if ($body_encoding eq $author_encoding) {
> +					# ok, we already have the right encoding
> +				}
> +				else {
> +					# uh oh, we should re-encode
IMHO we should bail here or do the recoding (and bail if that fails).
OTH this patch improves send-emails behaviour because currently it
doesn't bother at all and with this patch it could at least fix the
common cases.

So

	Acked-by: Uwe Kleine-König <Uwe.Kleine-Koenig@xxxxxxxx>

but note I only read the code, I didn't run it.

> +				}
> +			}
> +			else {
> +				push @xh,
> +				  'MIME-Version: 1.0',
> +				  "Content-Type: text/plain; charset=$author_encoding";
> +			}
> +		}
>  	}

Best regards
Uwe

-- 
Uwe Kleine-König, Software Engineer
Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux