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
This commit is contained in:
mkanat%bugzilla.org 2010-03-28 21:38:42 +00:00
parent 384011c336
commit d358bd657b
3 changed files with 10 additions and 2 deletions

View File

@ -1 +1 @@
7047
7048

View 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;
}

View File

@ -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',