]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 550765: Unicode strings from install_string were showing up as garbage
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Sun, 28 Mar 2010 21:20:32 +0000 (14:20 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Sun, 28 Mar 2010 21:20:32 +0000 (14:20 -0700)
when used in the web interface
r=LpSolit, a=LpSolit

Bugzilla/Install/Util.pm
checksetup.pl

index 55bbd455c82b7c7b107c762d6d80bb0edb900633..1e5c6b70a287770487f908cbb04288ac674f1924 100644 (file)
@@ -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;
 }
 
index 8993ff08d56c59f433cf595b30976068b502571e..a27446e0cf7be53e7eda2cd59556e3b5703f7166 100755 (executable)
@@ -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',