[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.7-873-g24f7810
? sunnavy
sunnavy at bestpractical.com
Tue Dec 14 00:27:07 EST 2010
The branch, 3.9-trunk has been updated
via 24f7810c6e90969fc9900c4f8ef79cc35543516c (commit)
via 2740286d3a1d99feca1582b141b0a770a9ee5e81 (commit)
via d189694efedd260341d1c2759399c38a36a8dce9 (commit)
from 7c074a6be00af4efd66fbcaf161778b55bfcb06f (commit)
Summary of changes:
lib/RT/Interface/Web.pm | 1 -
lib/RT/Record.pm | 13 +++++++++----
t/web/attachment_encoding.t | 7 ++++---
3 files changed, 13 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit d189694efedd260341d1c2759399c38a36a8dce9
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Dec 14 13:17:57 2010 +0800
logic fix: do *not* encode to utf8 if decode_utf8 is true
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 96c679b..5fc8f42 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -628,10 +628,15 @@ sub __Value {
my $value = $self->SUPER::__Value($field);
- if ( $args{'decode_utf8'} && !utf8::is_utf8($value) ) {
- utf8::decode($value);
- } elsif ( utf8::is_utf8($value) ) {
- utf8::encode($value);
+ if ( $args{'decode_utf8'} ) {
+ if ( !utf8::is_utf8($value) ) {
+ utf8::decode($value);
+ }
+ }
+ else {
+ if ( utf8::is_utf8($value) ) {
+ utf8::encode($value);
+ }
}
return $value;
commit 2740286d3a1d99feca1582b141b0a770a9ee5e81
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Dec 14 13:18:26 2010 +0800
filename is already utf8 encoded
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 368f793..da6040d 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1492,7 +1492,6 @@ sub MakeMIMEEntity {
# Prefer the cached name first over CGI.pm stringification.
my $filename = $RT::Mason::CGI::Filename;
$filename = "$filehandle" unless defined $filename;
- $filename = Encode::encode_utf8( $filename );
$filename =~ s{^.*[\\/]}{};
$Message->attach(
commit 24f7810c6e90969fc9900c4f8ef79cc35543516c
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Dec 14 13:19:25 2010 +0800
i18n test of attach file name with web ui
diff --git a/t/web/attachment_encoding.t b/t/web/attachment_encoding.t
index 38e4034..992be17 100644
--- a/t/web/attachment_encoding.t
+++ b/t/web/attachment_encoding.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 30;
+use RT::Test tests => 32;
use Encode;
my ( $baseurl, $m ) = RT::Test->started_ok;
ok $m->login, 'logged in as root';
@@ -45,7 +45,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
{
my $file =
- File::Spec->catfile( File::Spec->tmpdir, 'rt_attachemnt_abcde.txt' );
+ File::Spec->catfile( File::Spec->tmpdir, encode_utf8 'é件.txt' );
open my $fh, '>', $file or die $!;
binmode $fh, ':utf8';
print $fh 'é件';
@@ -59,6 +59,8 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
fields => { Subject => 'æ é¢', Content => 'æµè¯', Attach => $file },
);
$m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
+ $m->content_contains( 'é件.txt', 'attached filename' );
+ $m->content_lacks( encode_utf8 'é件.txt', 'no double encoded attached filename' );
$m->follow_link_ok( { text => 'with headers' },
'-> /Ticket/Attachment/WithHeaders/...' );
@@ -98,4 +100,3 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
unlink $file;
}
-
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list