Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Commit
rt branch, 4.0/unknown-email-charset, updated. rt-4.0.5-141-g327336a
 

Index | Next | Previous | View Flat


ruz at bestpractical

May 9, 2012, 12:57 PM


Views: 170
Permalink
rt branch, 4.0/unknown-email-charset, updated. rt-4.0.5-141-g327336a

The branch, 4.0/unknown-email-charset has been updated
via 327336a5e88398f6b52161e9ade8661c8b80184c (commit)
via 2435b8835700a304a87fe822022c05beb2dffaa0 (commit)
via 5806471ff1dbb2400a9afd7225c49e2e23ac9560 (commit)
via 2b863650c16d1b5ae872d60f29b72f128716b50c (commit)
via 484351407de29b9417c4646f362ee10ab1138487 (commit)
via 5a5f0af5299f5b17f74889751801eb1e88a259a5 (commit)
from 8a8aad65e142c89453221e37f989f627d6410b34 (commit)

Summary of changes:
lib/RT/I18N.pm | 37 +++++++++++++++++++++++++--------
t/mail/mime_decoding.t | 44 +++++++++++++++++++++++++++++++++++++++-
t/mail/not-supported-charset.t | 20 ++++++++++++++++++
3 files changed, 91 insertions(+), 10 deletions(-)

- Log -----------------------------------------------------------------
commit 2b863650c16d1b5ae872d60f29b72f128716b50c
Author: Ruslan Zakirov <ruz [at] bestpractical>
Date: Wed May 9 17:35:38 2012 +0400

test ?Q? header encoding with not supported charset

diff --git a/t/mail/not-supported-charset.t b/t/mail/not-supported-charset.t
index aefe80c..97bafcc 100644
--- a/t/mail/not-supported-charset.t
+++ b/t/mail/not-supported-charset.t
@@ -39,4 +39,24 @@ END
;
}

+{
+ my $mail = <<'END';
+From: root [at] localhos
+Subject: =?not-supported?Q?=07test=A9?=
+Content-type: text/plain; charset="ascii"
+
+ho hum just some text
+
+END
+
+ my ($stat, $id) = RT::Test->send_via_mailgate($mail);
+ is( $stat >> 8, 0, "The mail gateway exited normally" );
+ ok( $id, "created ticket" );
+
+ my $ticket = RT::Ticket->new( RT->SystemUser );
+ $ticket->Load($id);
+ ok $ticket->id, "loaded ticket";
+ is $ticket->Subject, '?test?';
+}
+
done_testing;
\ No newline at end of file

commit 2435b8835700a304a87fe822022c05beb2dffaa0
Merge: 2b86365 5806471
Author: Ruslan Zakirov <ruz [at] bestpractical>
Date: Wed May 9 18:26:58 2012 +0400

Merge branch '4.0/encoded-word-whitespace' into 4.0/unknown-email-charset


commit 327336a5e88398f6b52161e9ade8661c8b80184c
Author: Ruslan Zakirov <ruz [at] bestpractical>
Date: Wed May 9 19:01:05 2012 +0400

handle not supported charsets in Q/B encoded words

There is no good way to save original content. We
preserve only printable ascii characters, everything
else replaced with \x{FFFD} unicode code point.

diff --git a/lib/RT/I18N.pm b/lib/RT/I18N.pm
index f8c2930..6230070 100644
--- a/lib/RT/I18N.pm
+++ b/lib/RT/I18N.pm
@@ -359,7 +359,14 @@ sub DecodeMIMEWordsToEncoding {

# now we have got a decoded subject, try to convert into the encoding
unless ( $charset eq $to_charset ) {
- Encode::from_to( $enc_str, $charset, $to_charset );
+ if ( Encode::find_encoding($charset) ) {
+ Encode::from_to( $enc_str, $charset, $to_charset );
+ } else {
+ $RT::Logger->warning("Charset '$charset' is not supported");
+ $enc_str =~ s/[^[:print:]]/\357\277\275/g;
+ Encode::from_to( $enc_str, 'UTF-8', $to_charset )
+ unless $to_charset eq 'utf-8';
+ }
}

# XXX TODO: RT doesn't currently do the right thing with mime-encoded headers
diff --git a/t/mail/not-supported-charset.t b/t/mail/not-supported-charset.t
index 97bafcc..cccee0a 100644
--- a/t/mail/not-supported-charset.t
+++ b/t/mail/not-supported-charset.t
@@ -56,7 +56,7 @@ END
my $ticket = RT::Ticket->new( RT->SystemUser );
$ticket->Load($id);
ok $ticket->id, "loaded ticket";
- is $ticket->Subject, '?test?';
+ is $ticket->Subject, "\x{FFFD}test\x{FFFD}";
}

done_testing;
\ No newline at end of file

-----------------------------------------------------------------------
_______________________________________________
Rt-commit mailing list
Rt-commit [at] lists
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit

Subject User Time
rt branch, 4.0/unknown-email-charset, updated. rt-4.0.5-141-g327336a ruz at bestpractical May 9, 2012, 12:57 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.