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-encodeIMHO 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