From 0446b5c7b035bcfe9d54d863e8de3864d712c542 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Tue, 25 Feb 2014 21:42:13 +0100 Subject: Bug 405011: Text is cut off when containing Unicode supplementary characters (outside BMP) with MySQL as backend r=gerv a=justdave --- Bugzilla/Bug.pm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Bugzilla/Bug.pm') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 367804862..73b50018a 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -3412,9 +3412,15 @@ sub comments { if (!defined $self->{'comments'}) { $self->{'comments'} = Bugzilla::Comment->match({ bug_id => $self->id }); my $count = 0; + my $is_mysql = Bugzilla->dbh->isa('Bugzilla::DB::Mysql') ? 1 : 0; foreach my $comment (@{ $self->{'comments'} }) { $comment->{count} = $count++; $comment->{bug} = $self; + # XXX - hack for MySQL. Convert [U+....] back into its Unicode + # equivalent for characters above U+FFFF as MySQL older than 5.5.3 + # cannot store them, see Bugzilla::Comment::_check_thetext(). + $comment->{thetext} =~ s/\x{FDD0}\[U\+((?:[1-9A-F]|10)[0-9A-F]{4})\]\x{FDD1}/chr(hex $1)/eg + if $is_mysql; } # Some bugs may have no comments when upgrading old installations. Bugzilla::Comment->preload($self->{'comments'}) if $count; -- cgit v1.2.3-24-g4f1b