From d358bd657b7b17217ca79032d320a3cf6e04a42c Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" Date: Sun, 28 Mar 2010 21:38:42 +0000 Subject: [PATCH] Bug 550765: Unicode strings from install_string were showing up as garbage when used in the web interface r=LpSolit, a=LpSolit git-svn-id: svn://10.0.0.236/branches/BUGZILLA-3_6-BRANCH@260074 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/.bzrrev | 2 +- mozilla/webtools/bugzilla/Bugzilla/Install/Util.pm | 4 +++- mozilla/webtools/bugzilla/checksetup.pl | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mozilla/webtools/bugzilla/.bzrrev b/mozilla/webtools/bugzilla/.bzrrev index d7b876cbce2..e4da819bbd3 100644 --- a/mozilla/webtools/bugzilla/.bzrrev +++ b/mozilla/webtools/bugzilla/.bzrrev @@ -1 +1 @@ -7047 \ No newline at end of file +7048 \ No newline at end of file diff --git a/mozilla/webtools/bugzilla/Bugzilla/Install/Util.pm b/mozilla/webtools/bugzilla/Bugzilla/Install/Util.pm index 55bbd455c82..1e5c6b70a28 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Install/Util.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Install/Util.pm @@ -265,6 +265,8 @@ sub install_string { die "No language defines the string '$string_id'" if !defined $string_template; + utf8::decode($string_template) if !utf8::is_utf8($string_template); + $vars ||= {}; my @replace_keys = keys %$vars; foreach my $key (@replace_keys) { @@ -281,7 +283,7 @@ sub install_string { } $string_template =~ s/\Q##$key##\E/$replacement/g; } - + return $string_template; } diff --git a/mozilla/webtools/bugzilla/checksetup.pl b/mozilla/webtools/bugzilla/checksetup.pl index 8993ff08d56..a27446e0cf7 100755 --- a/mozilla/webtools/bugzilla/checksetup.pl +++ b/mozilla/webtools/bugzilla/checksetup.pl @@ -62,6 +62,12 @@ use Bugzilla::Install::Util qw(install_string get_version_and_os init_console); # When we're running at the command line, we need to pick the right # language before ever displaying any string. init_console(); +# Required for displaying strings from install_string, which are always +# in UTF-8, in every language. For other scripts, Bugzilla::init_page +# handles this, but here we just need to assume that checksetup.pl output +# is always UTF-8 in order for install_string to work properly in other +# languages. +binmode STDOUT, ':utf8'; my %switch; GetOptions(\%switch, 'help|h|?', 'check-modules', 'no-templates|t',