git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Uwe Kleine-König <uwe.kleine-koenig@digi.com>
Date
Nov 16, 2007, 11:14 UTC
Message-ID
<20071116111450.GA22783@bre-cln-ukleine.digi.com>
In-Reply-To
<20071116104907.GA13087@sigill.intra.peff.net>
Hello Jeff,
Show 12 quoted lines
>  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. :-)

Show 12 quoted lines
>  [...]
> @@ -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@digi.com>
but note I only read the code, I didn't run it.
Show 9 quoted lines
> +				}
> +			}
> +			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
Previous: Jeff KingNext: Junio C Hamano
Message 3 of 9 in “[BUG] encoding problem with format-patch + send-email”
  1. Uwe Kleine-KönigNov 15, 2007
  2. Jeff KingNov 16, 2007
  3. Uwe Kleine-KönigNov 16, 2007
  4. Junio C HamanoNov 17, 2007
  5. Uwe Kleine-KönigNov 19, 2007
  6. Brian SwetlandNov 19, 2007
  7. send-email: add transfer encoding header with content-typeJeff King, Nov 20, 2007
  8. Uwe Kleine-KönigNov 20, 2007
  9. Junio C HamanoNov 21, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.