Skip to content

Commit

Permalink
Move "use Encode" calls to one central location
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmv committed Sep 3, 2014
1 parent 4d70cfb commit b2e341b
Show file tree
Hide file tree
Showing 26 changed files with 4 additions and 31 deletions.
1 change: 1 addition & 0 deletions lib/RT.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ use 5.010;
package RT;


use Encode ();
use File::Spec ();
use Cwd ();
use Scalar::Util qw(blessed);
Expand Down
1 change: 0 additions & 1 deletion lib/RT/I18N.pm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ use Locale::Maketext 1.04;
use Locale::Maketext::Lexicon 0.25;
use base 'Locale::Maketext::Fuzzy';

use Encode;
use MIME::Entity;
use MIME::Head;
use File::Glob;
Expand Down
1 change: 0 additions & 1 deletion lib/RT/Interface/Web.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ use URI qw();
use RT::Interface::Web::Menu;
use RT::Interface::Web::Session;
use Digest::MD5 ();
use Encode qw();
use List::MoreUtils qw();
use JSON qw();
use Plack::Util;
Expand Down
1 change: 0 additions & 1 deletion lib/RT/Interface/Web/Handler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ use Plack::Builder;
use Plack::Request;
use Plack::Response;
use Plack::Util;
use Encode;

sub PSGIApp {
my $self = shift;
Expand Down
1 change: 0 additions & 1 deletion lib/RT/Record.pm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ require RT::User;
require RT::Attributes;
require RT::Transactions;
require RT::Link;
use Encode qw();

our $_TABLE_ATTR = { };

Expand Down
1 change: 0 additions & 1 deletion lib/RT/Template.pm
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@ sub _DowngradeFromHTML {
$orig_entity->head->mime_attr( "Content-Type" => 'text/html' );
$orig_entity->head->mime_attr( "Content-Type.charset" => 'utf-8' );

require Encode;
my $body = $new_entity->bodyhandle->as_string;
$body = Encode::decode( "UTF-8", $body );
my $html = RT::Interface::Email::ConvertHTMLToText( $body );
Expand Down
1 change: 0 additions & 1 deletion lib/RT/User.pm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ use Crypt::Eksblowfish::Bcrypt qw();
use RT::Principals;
use RT::ACE;
use RT::Interface::Email;
use Encode;
use Text::Password::Pronounceable;

sub _OverlayAccessible {
Expand Down
1 change: 0 additions & 1 deletion share/html/NoAuth/iCal/dhandler
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
<%init>
use Data::ICal;
use Data::ICal::Entry::Event;
use Encode ();

my $path = $m->dhandler_arg;

Expand Down
2 changes: 0 additions & 2 deletions share/html/Search/Elements/ResultsRSSView
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
%#
%# END BPS TAGGED BLOCK }}}
<%INIT>
use Encode ();

my $old_current_user;

if ( $m->request_comp->path =~ RT->Config->Get('WebNoAuthRegex') ) {
Expand Down
1 change: 0 additions & 1 deletion t/00-mason-syntax.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use HTML::Mason;
use HTML::Mason::Compiler;
use HTML::Mason::Compiler::ToObject;
BEGIN { require RT::Test; }
use Encode;

sub compile_file {
my $file = shift;
Expand Down
1 change: 0 additions & 1 deletion t/api/attachment.t
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ is ($#headers, 2, "testing a bunch of singline multiple headers" );
my $mime = $attachment->ContentAsMIME;
like( $mime->head->get('Content-Type'),
qr/charset="iso-8859-1"/, 'content type of ContentAsMIME is original' );
require Encode;
is(
Encode::decode( 'iso-8859-1', $mime->stringify_body ),
Encode::decode( 'UTF-8', "Håvard\n" ),
Expand Down
1 change: 0 additions & 1 deletion t/api/canonical_charset.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use strict;

use RT::Test nodata => 1, tests => 11;
use RT::I18N;
use Encode;

my %map = (
'euc-cn' => 'gbk',
Expand Down
2 changes: 0 additions & 2 deletions t/api/i18n_guess.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ use warnings;

use RT::Test tests => 16;

use Encode qw(encode);

use constant HAS_ENCODE_GUESS => Encode::Guess->require;
use constant HAS_ENCODE_DETECT => Encode::Detect::Detector->require;

Expand Down
1 change: 0 additions & 1 deletion t/api/i18n_mime_encoding.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use strict;

use RT::Test nodata => 1, tests => undef;
use RT::I18N;
use Encode;
use Test::Warn;

diag "normal mime encoding conversion: utf8 => iso-8859-1";
Expand Down
1 change: 0 additions & 1 deletion t/api/password-types.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use warnings;

use RT::Test;
use Digest::MD5;
use Encode;

my $default = "bcrypt";

Expand Down
1 change: 0 additions & 1 deletion t/mail/charsets-outgoing-plaintext.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use strict;
use warnings;
use Encode;

use RT::Test tests => 79, text_templates => 1;

Expand Down
1 change: 0 additions & 1 deletion t/mail/charsets-outgoing.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use strict;
use warnings;
use Encode;

use RT::Test tests => 78;

Expand Down
1 change: 0 additions & 1 deletion t/mail/header-characters.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use warnings;

use RT::Test tests => 12;
use Test::Warn;
use Encode;

my ($baseurl, $m) = RT::Test->started_ok;

Expand Down
7 changes: 3 additions & 4 deletions t/mail/wrong_mime_charset.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use warnings;
use RT::Test nodb => 1, tests => undef;

use_ok('RT::I18N');
use Encode;
my $test_string = Encode::decode("UTF-8", 'À');
my $encoded_string = encode( 'iso-8859-1', $test_string );
my $encoded_string = Encode::encode( 'iso-8859-1', $test_string );
my $mime = MIME::Entity->build(
"Subject" => $encoded_string,
"Data" => [$encoded_string],
Expand Down Expand Up @@ -35,10 +34,10 @@ like(
"We can't encode something into the wrong encoding without Encode complaining"
);

my $subject = decode( 'iso-8859-1', $mime->head->get('Subject') );
my $subject = Encode::decode( 'iso-8859-1', $mime->head->get('Subject') );
chomp $subject;
is( $subject, $test_string, 'subject is set to iso-8859-1' );
my $body = decode( 'iso-8859-1', $mime->stringify_body );
my $body = Encode::decode( 'iso-8859-1', $mime->stringify_body );
chomp $body;
is( $body, $test_string, 'body is set to iso-8859-1' );

Expand Down
1 change: 0 additions & 1 deletion t/web/attachment_encoding.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use strict;
use warnings;

use RT::Test tests => 32;
use Encode;
my ( $baseurl, $m ) = RT::Test->started_ok;
ok $m->login, 'logged in as root';

Expand Down
1 change: 0 additions & 1 deletion t/web/basic.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

use strict;
use warnings;
use Encode;

use RT::Test tests => 24;

Expand Down
1 change: 0 additions & 1 deletion t/web/compilation_errors.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ BEGIN {
use HTTP::Request::Common;
use HTTP::Cookies;
use LWP;
use Encode;

my $cookie_jar = HTTP::Cookies->new;

Expand Down
1 change: 0 additions & 1 deletion t/web/html_template.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use strict;
use warnings;

use RT::Test tests => undef;
use Encode;
my ( $baseurl, $m ) = RT::Test->started_ok;
ok $m->login, 'logged in as root';

Expand Down
1 change: 0 additions & 1 deletion t/web/query_builder.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use warnings;
use HTTP::Request::Common;
use HTTP::Cookies;
use LWP;
use Encode;
use RT::Test tests => 70;

my $cookie_jar = HTTP::Cookies->new;
Expand Down
1 change: 0 additions & 1 deletion t/web/rest-non-ascii-subject.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use strict;
use warnings;
use RT::Test tests => 9;

use Encode;
my $subject = Encode::decode('latin1', "Sujet accentu\x{e9}");
my $text = Encode::decode('latin1', "Contenu accentu\x{e9}");

Expand Down
2 changes: 0 additions & 2 deletions t/web/ticket-create-utf8.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ use warnings;

use RT::Test tests => 43;

use Encode;

my $ru_test = "\x{442}\x{435}\x{441}\x{442}";
my $ru_support = "\x{43f}\x{43e}\x{434}\x{434}\x{435}\x{440}\x{436}\x{43a}\x{430}";

Expand Down

0 comments on commit b2e341b

Please sign in to comment.