From: Max Kanat-Alexander Date: Sun, 28 Mar 2010 21:19:26 +0000 (-0700) Subject: Bug 550765: Unicode strings from install_string were showing up as garbage X-Git-Tag: bugzilla-3.7.1~161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b32a0b4336a3182df4896ca207f3f30c264b0061;p=thirdparty%2Fbugzilla.git Bug 550765: Unicode strings from install_string were showing up as garbage when used in the web interface r=LpSolit, a=LpSolit --- diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm index 233e08e196..6621a7a417 100644 --- a/Bugzilla/Install/Util.pm +++ b/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/checksetup.pl b/checksetup.pl index 8993ff08d5..a27446e0cf 100755 --- a/checksetup.pl +++ b/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',