[Rt-commit] rt branch, another_utf8_rework, updated. rt-3.8.7-57-gfe84d7a

Ruslan Zakirov ruz at bestpractical.com
Fri Dec 18 20:16:15 EST 2009


The branch, another_utf8_rework has been updated
       via  fe84d7a6e2120078527d650ab88e96b1263fc903 (commit)
       via  a6e855c1cf6825d7c95f964afb59779fa4cbfb67 (commit)
       via  836555dda8f2984c95215bd24574a0a71a6a5713 (commit)
       via  b9232ecb3e192e300c0e7f9237dc05e33c75f40e (commit)
      from  93972ffeb04f37b48b17ebdba7af0b232a358e4e (commit)

Summary of changes:
 lib/RT/Attachment_Overlay.pm |    7 ++-
 lib/RT/Interface/Email.pm    |    2 +-
 lib/RT/Interface/Web.pm      |   24 +++++-----
 lib/RT/Ticket_Overlay.pm     |    4 +-
 t/mail/charsets-outgoing.t   |   99 ++++++++++++++++++++++++++----------------
 t/web/ticket-create-utf8.t   |   94 ++++++++++++++++++++++------------------
 6 files changed, 133 insertions(+), 97 deletions(-)

- Log -----------------------------------------------------------------
commit b9232ecb3e192e300c0e7f9237dc05e33c75f40e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Dec 18 23:06:28 2009 +0300

    test not only cyrillic, but latin1 as well

diff --git a/t/web/ticket-create-utf8.t b/t/web/ticket-create-utf8.t
index a4d7ae9..ad5364f 100644
--- a/t/web/ticket-create-utf8.t
+++ b/t/web/ticket-create-utf8.t
@@ -10,9 +10,14 @@ $RT::Test::SKIP_REQUEST_WORK_AROUND = 1;
 use Encode;
 
 my $ru_test = "\x{442}\x{435}\x{441}\x{442}";
-my $ru_autoreply = "\x{410}\x{432}\x{442}\x{43e}\x{43e}\x{442}\x{432}\x{435}\x{442}";
 my $ru_support = "\x{43f}\x{43e}\x{434}\x{434}\x{435}\x{440}\x{436}\x{43a}\x{430}";
 
+# latin-1 is very special in perl, we should test everything with latin-1 umlauts
+# and not-ascii+not-latin1, for example cyrillic
+my $l1_test = Encode::decode('latin-1', "t\xE9st");
+my $l1_support = Encode::decode('latin-1', "supp\xF6rt");
+
+
 my $q = RT::Test->load_or_create_queue( Name => 'Regression' );
 ok $q && $q->id, 'loaded or created queue';
 
@@ -25,59 +30,64 @@ my ($baseurl, $m) = RT::Test->started_ok;
 ok $m->login, 'logged in';
 
 # create a ticket with a subject only
-{
+foreach my $test_str ( $ru_test, $l1_test ) {
     ok $m->goto_create_ticket( $q ), "go to create ticket";
     $m->form_number(3);
-    $m->field( Subject => $ru_test );
+    $m->field( Subject => $test_str );
     $m->submit;
 
     $m->content_like( 
-        qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i,
+        qr{<td\s+class="message-header-value"[^>]*>\s*\Q$test_str\E\s*</td>}i,
         'header on the page'
     );
 
     my $ticket = RT::Test->last_ticket;
-    is $ticket->Subject, $ru_test, "correct subject";
+    is $ticket->Subject, $test_str, "correct subject";
 }
 
 # create a ticket with a subject and content
-{
-    ok $m->goto_create_ticket( $q ), "go to create ticket";
-    $m->form_number(3);
-    $m->field( Subject => $ru_test );
-    $m->field( Content => $ru_support );
-    $m->submit;
-
-    $m->content_like( 
-        qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i,
-        'header on the page'
-    );
-    $m->content_like( 
-        qr{\Q$ru_support\E}i,
-        'content on the page'
-    );
-
-    my $ticket = RT::Test->last_ticket;
-    is $ticket->Subject, $ru_test, "correct subject";
+foreach my $test_str ( $ru_test, $l1_test ) {
+    foreach my $support_str ( $ru_support, $l1_support ) {
+        ok $m->goto_create_ticket( $q ), "go to create ticket";
+        $m->form_number(3);
+        $m->field( Subject => $test_str );
+        $m->field( Content => $support_str );
+        $m->submit;
+
+        $m->content_like( 
+            qr{<td\s+class="message-header-value"[^>]*>\s*\Q$test_str\E\s*</td>}i,
+            'header on the page'
+        );
+        $m->content_like( 
+            qr{\Q$support_str\E}i,
+            'content on the page'
+        );
+
+        my $ticket = RT::Test->last_ticket;
+        is $ticket->Subject, $test_str, "correct subject";
+    }
 }
 
 # create a ticket with a subject and content
-{
-    ok $m->goto_create_ticket( $q ), "go to create ticket";
-    $m->form_number(3);
-    $m->field( Subject => $ru_test );
-    $m->field( Content => $ru_support );
-    $m->submit;
-
-    $m->content_like( 
-        qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i,
-        'header on the page'
-    );
-    $m->content_like( 
-        qr{\Q$ru_support\E}i,
-        'content on the page'
-    );
-
-    my $ticket = RT::Test->last_ticket;
-    is $ticket->Subject, $ru_test, "correct subject";
+foreach my $test_str ( $ru_test, $l1_test ) {
+    foreach my $support_str ( $ru_support, $l1_support ) {
+        ok $m->goto_create_ticket( $q ), "go to create ticket";
+        $m->form_number(3);
+        $m->field( Subject => $test_str );
+        $m->field( Content => $support_str );
+        $m->submit;
+
+        $m->content_like( 
+            qr{<td\s+class="message-header-value"[^>]*>\s*\Q$test_str\E\s*</td>}i,
+            'header on the page'
+        );
+        $m->content_like( 
+            qr{\Q$support_str\E}i,
+            'content on the page'
+        );
+
+        my $ticket = RT::Test->last_ticket;
+        is $ticket->Subject, $test_str, "correct subject";
+    }
 }
+

commit 836555dda8f2984c95215bd24574a0a71a6a5713
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Dec 19 03:30:59 2009 +0300

    increase number of tests

diff --git a/t/web/ticket-create-utf8.t b/t/web/ticket-create-utf8.t
index ad5364f..f37eeec 100644
--- a/t/web/ticket-create-utf8.t
+++ b/t/web/ticket-create-utf8.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 14;
+use RT::Test tests => 41;
 
 $RT::Test::SKIP_REQUEST_WORK_AROUND = 1;
 

commit a6e855c1cf6825d7c95f964afb59779fa4cbfb67
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Dec 19 03:31:15 2009 +0300

    we shouldn't store strings with UTF-8 flag in MIME::Head

diff --git a/lib/RT/Attachment_Overlay.pm b/lib/RT/Attachment_Overlay.pm
index 1d508c0..e709814 100644
--- a/lib/RT/Attachment_Overlay.pm
+++ b/lib/RT/Attachment_Overlay.pm
@@ -120,8 +120,9 @@ sub Create {
 
     # Get the subject
     my $Subject = $Attachment->head->get( 'subject', 0 );
-    defined($Subject) or $Subject = '';
-    chomp($Subject);
+    $Subject = '' unless defined $Subject;
+    chomp $Subject;
+    utf8::decode( $Subject ) unless utf8::is_utf8( $Subject );
 
     #Get the Message-ID
     my $MessageId = $Attachment->head->get( 'Message-ID', 0 );
@@ -135,7 +136,7 @@ sub Create {
     # MIME::Head doesn't support perl strings well and can return
     # octets which later will be double encoded in low-level code
     my $head = $Attachment->head->as_string;
-    utf8::decode( $head );
+    utf8::decode( $head ) unless utf8::is_utf8( $head );
 
     # If a message has no bodyhandle, that means that it has subparts (or appears to)
     # and we should act accordingly.  
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index b669b5b..9a5f59d 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -565,7 +565,7 @@ sub SendEmailUsingTemplate {
         return -1;
     }
 
-    $mail->head->set( $_ => $args{ $_ } )
+    $mail->head->set( $_ => Encode::encode_utf8( $args{ $_ } ) )
         foreach grep defined $args{$_}, qw(To Cc Bcc From);
 
     SetInReplyTo( Message => $mail, InReplyTo => $args{'InReplyTo'} );
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index b4279fb..562ee36 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -874,7 +874,9 @@ sub CreateTicket {
     }
 
     foreach my $argument (qw(Encrypt Sign)) {
-        $MIMEObj->head->add( "X-RT-$argument" => $ARGS{$argument} ) if defined $ARGS{$argument};
+        $MIMEObj->head->add(
+            "X-RT-$argument" => Encode::encode_utf8( $ARGS{$argument} )
+        ) if defined $ARGS{$argument};
     }
 
     my %create_args = (
@@ -1084,7 +1086,9 @@ sub ProcessUpdateMessage {
         Type    => $args{ARGSRef}->{'UpdateContentType'},
     );
 
-    $Message->head->add( 'Message-ID' => RT::Interface::Email::GenMessageId( Ticket => $args{'TicketObj'}, ) );
+    $Message->head->add( 'Message-ID' => Encode::encode_utf8(
+        RT::Interface::Email::GenMessageId( Ticket => $args{'TicketObj'} )
+    ) );
     my $old_txn = RT::Transaction->new( $session{'CurrentUser'} );
     if ( $args{ARGSRef}->{'QuoteTransaction'} ) {
         $old_txn->Load( $args{ARGSRef}->{'QuoteTransaction'} );
@@ -1182,9 +1186,8 @@ sub MakeMIMEEntity {
     );
     my $Message = MIME::Entity->build(
         Type    => 'multipart/mixed',
-        Subject => $args{'Subject'} || "",
-        From    => $args{'From'},
-        Cc      => $args{'Cc'},
+        map { $_ => Encode::encode_utf8( $args{ $_} ) }
+            grep defined $args{$_}, qw(Subject From Cc)
     );
 
     if ( defined $args{'Body'} && length $args{'Body'} ) {
@@ -1192,12 +1195,8 @@ sub MakeMIMEEntity {
         # Make the update content have no 'weird' newlines in it
         $args{'Body'} =~ s/\r\n/\n/gs;
 
-        # MIME::Head is not happy in utf-8 domain.  This only happens
-        # when processing an incoming email (so far observed).
-        no utf8;
-        use bytes;
         $Message->attach(
-            Type => $args{'Type'} || 'text/plain',
+            Type    => $args{'Type'} || 'text/plain',
             Charset => 'UTF-8',
             Data    => $args{'Body'},
         );
@@ -1218,8 +1217,8 @@ sub MakeMIMEEntity {
 
             # Prefer the cached name first over CGI.pm stringification.
             my $filename = $RT::Mason::CGI::Filename;
-            $filename = "$filehandle" unless defined($filename);
-            $filename = Encode::decode_utf8($filename);
+            $filename = "$filehandle" unless defined $filename;
+            $filename = Encode::encode_utf8( $filename );
             $filename =~ s{^.*[\\/]}{};
 
             $Message->attach(
@@ -1234,6 +1233,7 @@ sub MakeMIMEEntity {
     }
 
     $Message->make_singlepart;
+
     RT::I18N::SetMIMEEntityToUTF8($Message);    # convert text parts into utf-8
 
     return ($Message);
diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index 1c5190c..03419f8 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -2154,13 +2154,13 @@ sub _RecordNote {
             my $addresses = join ', ', (
                 map { RT::User->CanonicalizeEmailAddress( $_->address ) }
                     Email::Address->parse( $args{ $type . 'MessageTo' } ) );
-            $args{'MIMEObj'}->head->add( 'RT-Send-' . $type, $addresses );
+            $args{'MIMEObj'}->head->add( 'RT-Send-' . $type, Encode::encode_utf8( $addresses ) );
         }
     }
 
     foreach my $argument (qw(Encrypt Sign)) {
         $args{'MIMEObj'}->head->add(
-            "X-RT-$argument" => $args{ $argument }
+            "X-RT-$argument" => Encode::encode_utf8( $args{ $argument } )
         ) if defined $args{ $argument };
     }
 

commit fe84d7a6e2120078527d650ab88e96b1263fc903
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Dec 19 04:03:37 2009 +0300

    test on strings with latin1 only characters
    
    latin1 is a special character set in perl, so every time
    we test support for unicode we should run all tests on latin1 only
    strings and some not-ascii+not-latin1 text

diff --git a/t/mail/charsets-outgoing.t b/t/mail/charsets-outgoing.t
index ca44bbd..e8f78cc 100644
--- a/t/mail/charsets-outgoing.t
+++ b/t/mail/charsets-outgoing.t
@@ -1,10 +1,22 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use utf8;
-
-use RT::Test tests => 30;
-
+use Encode;
+
+use RT::Test tests => 78;
+
+my %string = (
+    ru => {
+        test      => "\x{442}\x{435}\x{441}\x{442}",
+        autoreply => "\x{410}\x{432}\x{442}\x{43e}\x{43e}\x{442}\x{432}\x{435}\x{442}",
+        support   => "\x{43f}\x{43e}\x{434}\x{434}\x{435}\x{440}\x{436}\x{43a}\x{430}",
+    },
+    latin1 => {
+        test      => Encode::decode('latin1', "t\xE9st"),
+        autoreply => Encode::decode('latin1', "a\xFCtoreply"),
+        support   => Encode::decode('latin1', "supp\xF5rt"),
+    },
+);
 
 RT::Test->set_mail_catcher;
 
@@ -49,17 +61,13 @@ diag "basic test of autoreply" if $ENV{'TEST_VERBOSE'};
     ok @mails, "got some outgoing emails";
 }
 
-my $str_ru_test = "\x{442}\x{435}\x{441}\x{442}";
-my $str_ru_autoreply = "\x{410}\x{432}\x{442}\x{43e}\x{43e}\x{442}\x{432}\x{435}\x{442}";
-my $str_ru_support = "\x{43f}\x{43e}\x{434}\x{434}\x{435}\x{440}\x{436}\x{43a}\x{430}";
-
 diag "non-ascii Subject with ascii prefix set in the template"
     if $ENV{'TEST_VERBOSE'};
-{
+foreach my $set ( 'ru', 'latin1' ) {
     my $ticket = RT::Ticket->new( $RT::SystemUser );
     $ticket->Create(
         Queue => $queue->id,
-        Subject => $str_ru_test,
+        Subject => $string{$set}{test},
         Requestor => 'root at localhost',
     );
     my @mails = RT::Test->fetch_caught_mails;
@@ -69,15 +77,17 @@ diag "non-ascii Subject with ascii prefix set in the template"
     foreach my $mail ( @mails ) {
         my $entity = parse_mail( $mail );
         my $subject = Encode::decode_utf8( $entity->head->get('Subject') );
-        $subject =~ /$str_ru_test/
+        $subject =~ /$string{$set}{test}/
             or do { $status = 0; diag "wrong subject: $subject" };
     }
     ok $status, "all mails have correct data";
 }
 
+foreach my $tag_set ( 'ru', 'latin1' ) {
+
 diag "set non-ascii subject tag for the queue" if $ENV{'TEST_VERBOSE'};
 {
-    my ($status, $msg) = $queue->SetSubjectTag( $str_ru_support );
+    my ($status, $msg) = $queue->SetSubjectTag( $string{$tag_set}{support} );
     ok $status, "set subject tag for the queue" or diag "error: $msg";
 }
 
@@ -96,18 +106,18 @@ diag "ascii subject with non-ascii subject tag" if $ENV{'TEST_VERBOSE'};
     foreach my $mail ( @mails ) {
         my $entity = parse_mail( $mail );
         my $subject = Encode::decode_utf8( $entity->head->get('Subject') );
-        $subject =~ /$str_ru_support/
+        $subject =~ /$string{$tag_set}{support}/
             or do { $status = 0; diag "wrong subject: $subject" };
     }
     ok $status, "all mails have correct data";
 }
 
 diag "non-ascii subject with non-ascii subject tag" if $ENV{'TEST_VERBOSE'};
-{
+foreach my $set ( 'ru', 'latin1' ) {
     my $ticket = RT::Ticket->new( $RT::SystemUser );
     $ticket->Create(
         Queue => $queue->id,
-        Subject => $str_ru_test,
+        Subject => $string{$set}{test},
         Requestor => 'root at localhost',
     );
     my @mails = RT::Test->fetch_caught_mails;
@@ -117,20 +127,25 @@ diag "non-ascii subject with non-ascii subject tag" if $ENV{'TEST_VERBOSE'};
     foreach my $mail ( @mails ) {
         my $entity = parse_mail( $mail );
         my $subject = Encode::decode_utf8( $entity->head->get('Subject') );
-        $subject =~ /$str_ru_support/
+        $subject =~ /$string{$tag_set}{support}/
             or do { $status = 0; diag "wrong subject: $subject" };
-        $subject =~ /$str_ru_test/
+        $subject =~ /$string{$set}{test}/
             or do { $status = 0; diag "wrong subject: $subject" };
     }
     ok $status, "all mails have correct data";
 }
 
+} # subject tag
+
 diag "return back the empty subject tag" if $ENV{'TEST_VERBOSE'};
 {
     my ($status, $msg) = $queue->SetSubjectTag( undef );
     ok $status, "set subject tag for the queue" or diag "error: $msg";
 }
 
+
+foreach my $prefix_set ( 'ru', 'latin1' ) {
+
 diag "add non-ascii subject prefix in the autoreply template" if $ENV{'TEST_VERBOSE'};
 {
     my $template = RT::Template->new( $RT::SystemUser );
@@ -138,7 +153,7 @@ diag "add non-ascii subject prefix in the autoreply template" if $ENV{'TEST_VERB
     ok $template->id, "loaded autoreply tempalte";
 
     my ($status, $msg) = $template->SetContent(
-        "Subject: $str_ru_autoreply { \$Ticket->Subject }\n"
+        "Subject: $string{$prefix_set}{autoreply} { \$Ticket->Subject }\n"
         ."\n"
         ."hi there it's an autoreply.\n"
         ."\n"
@@ -161,7 +176,7 @@ diag "ascii subject with non-ascii subject prefix in template" if $ENV{'TEST_VER
     foreach my $mail ( @mails ) {
         my $entity = parse_mail( $mail );
         my $subject = Encode::decode_utf8( $entity->head->get('Subject') );
-        $subject =~ /$str_ru_autoreply/
+        $subject =~ /$string{$prefix_set}{autoreply}/
             or do { $status = 0; diag "wrong subject: $subject" };
     }
     ok $status, "all mails have correct data";
@@ -169,11 +184,11 @@ diag "ascii subject with non-ascii subject prefix in template" if $ENV{'TEST_VER
 
 diag "non-ascii subject with non-ascii subject prefix in template"
     if $ENV{'TEST_VERBOSE'};
-{
+foreach my $set ( 'ru', 'latin1' ) {
     my $ticket = RT::Ticket->new( $RT::SystemUser );
     $ticket->Create(
         Queue => $queue->id,
-        Subject => $str_ru_test,
+        Subject => $string{$set}{test},
         Requestor => 'root at localhost',
     );
     my @mails = RT::Test->fetch_caught_mails;
@@ -183,27 +198,28 @@ diag "non-ascii subject with non-ascii subject prefix in template"
     foreach my $mail ( @mails ) {
         my $entity = parse_mail( $mail );
         my $subject = Encode::decode_utf8( $entity->head->get('Subject') );
-        $subject =~ /$str_ru_autoreply/
+        $subject =~ /$string{$prefix_set}{autoreply}/
             or do { $status = 0; diag "wrong subject: $subject" };
-        $subject =~ /$str_ru_autoreply/
+        $subject =~ /$string{$set}{test}/
             or do { $status = 0; diag "wrong subject: $subject" };
     }
     ok $status, "all mails have correct data";
 }
 
+foreach my $tag_set ( 'ru', 'latin1' ) {
 diag "set non-ascii subject tag for the queue" if $ENV{'TEST_VERBOSE'};
 {
-    my ($status, $msg) = $queue->SetSubjectTag( $str_ru_support );
+    my ($status, $msg) = $queue->SetSubjectTag( $string{$tag_set}{support} );
     ok $status, "set subject tag for the queue" or diag "error: $msg";
 }
 
 diag "non-ascii subject, non-ascii prefix in template and non-ascii tag"
     if $ENV{'TEST_VERBOSE'};
-{
+foreach my $set ( 'ru', 'latin1' ) {
     my $ticket = RT::Ticket->new( $RT::SystemUser );
     $ticket->Create(
         Queue => $queue->id,
-        Subject => $str_ru_test,
+        Subject => $string{$set}{test},
         Requestor => 'root at localhost',
     );
     my @mails = RT::Test->fetch_caught_mails;
@@ -213,24 +229,30 @@ diag "non-ascii subject, non-ascii prefix in template and non-ascii tag"
     foreach my $mail ( @mails ) {
         my $entity = parse_mail( $mail );
         my $subject = Encode::decode_utf8( $entity->head->get('Subject') );
-        $subject =~ /$str_ru_autoreply/
+        $subject =~ /$string{$prefix_set}{autoreply}/
             or do { $status = 0; diag "wrong subject: $subject" };
-        $subject =~ /$str_ru_autoreply/
+        $subject =~ /$string{$tag_set}{support}/
             or do { $status = 0; diag "wrong subject: $subject" };
-        $subject =~ /$str_ru_autoreply/
+        $subject =~ /$string{$set}{test}/
             or do { $status = 0; diag "wrong subject: $subject" };
     }
     ok $status, "all mails have correct data";
 }
 
+} # subject tag
+
 diag "flush subject tag of the queue" if $ENV{'TEST_VERBOSE'};
 {
     my ($status, $msg) = $queue->SetSubjectTag( undef );
     ok $status, "set subject tag for the queue" or diag "error: $msg";
 }
 
+} # prefix set
+
 
 diag "don't change subject via template" if $ENV{'TEST_VERBOSE'};
+# clean DB has autoreply that always changes subject in template,
+# we should test situation when subject is not changed from template
 {
     my $template = RT::Template->new( $RT::SystemUser );
     $template->Load('Autoreply');
@@ -246,11 +268,11 @@ diag "don't change subject via template" if $ENV{'TEST_VERBOSE'};
 }
 
 diag "non-ascii Subject without changes in template" if $ENV{'TEST_VERBOSE'};
-{
+foreach my $set ( 'ru', 'latin1' ) {
     my $ticket = RT::Ticket->new( $RT::SystemUser );
     $ticket->Create(
         Queue => $queue->id,
-        Subject => $str_ru_test,
+        Subject => $string{$set}{test},
         Requestor => 'root at localhost',
     );
     my @mails = RT::Test->fetch_caught_mails;
@@ -260,25 +282,26 @@ diag "non-ascii Subject without changes in template" if $ENV{'TEST_VERBOSE'};
     foreach my $mail ( @mails ) {
         my $entity = parse_mail( $mail );
         my $subject = Encode::decode_utf8( $entity->head->get('Subject') );
-        $subject =~ /$str_ru_test/
+        $subject =~ /$string{$set}{test}/
             or do { $status = 0; diag "wrong subject: $subject" };
     }
     ok $status, "all mails have correct data";
 }
 
+foreach my $tag_set ( 'ru', 'latin1' ) {
 diag "set non-ascii subject tag for the queue" if $ENV{'TEST_VERBOSE'};
 {
-    my ($status, $msg) = $queue->SetSubjectTag( $str_ru_support );
+    my ($status, $msg) = $queue->SetSubjectTag( $string{$tag_set}{support} );
     ok $status, "set subject tag for the queue" or diag "error: $msg";
 }
 
 diag "non-ascii Subject without changes in template and with non-ascii subject tag"
     if $ENV{'TEST_VERBOSE'};
-{
+foreach my $set ( 'ru', 'latin1' ) {
     my $ticket = RT::Ticket->new( $RT::SystemUser );
     $ticket->Create(
         Queue => $queue->id,
-        Subject => $str_ru_test,
+        Subject => $string{$set}{test},
         Requestor => 'root at localhost',
     );
     my @mails = RT::Test->fetch_caught_mails;
@@ -288,14 +311,16 @@ diag "non-ascii Subject without changes in template and with non-ascii subject t
     foreach my $mail ( @mails ) {
         my $entity = parse_mail( $mail );
         my $subject = Encode::decode_utf8( $entity->head->get('Subject') );
-        $subject =~ /$str_ru_test/
+        $subject =~ /$string{$set}{test}/
             or do { $status = 0; diag "wrong subject: $subject" };
-        $subject =~ /$str_ru_support/
+        $subject =~ /$string{$tag_set}{support}/
             or do { $status = 0; diag "wrong subject: $subject" };
     }
     ok $status, "all mails have correct data";
 }
 
+} # subject tag set
+
 sub parse_mail {
     my $mail = shift;
     require RT::EmailParser;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list