diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2014-02-25 21:42:13 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2014-02-25 21:42:13 +0100 |
commit | 0446b5c7b035bcfe9d54d863e8de3864d712c542 (patch) | |
tree | 15093889bbc585f304771a94386273264b6fd4a6 /Bugzilla/Comment.pm | |
parent | dee2aa7187553971fb549be116d51c7ff69ee607 (diff) | |
download | bugzilla-0446b5c7b035bcfe9d54d863e8de3864d712c542.tar.gz bugzilla-0446b5c7b035bcfe9d54d863e8de3864d712c542.tar.xz |
Bug 405011: Text is cut off when containing Unicode supplementary characters (outside BMP) with MySQL as backend
r=gerv a=justdave
Diffstat (limited to 'Bugzilla/Comment.pm')
-rw-r--r-- | Bugzilla/Comment.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Bugzilla/Comment.pm b/Bugzilla/Comment.pm index d1e1e2530..0dada24cf 100644 --- a/Bugzilla/Comment.pm +++ b/Bugzilla/Comment.pm @@ -424,6 +424,15 @@ sub _check_thetext { $thetext =~ s/\s*$//s; $thetext =~ s/\r\n?/\n/g; # Get rid of \r. + # Characters above U+FFFF cannot be stored by MySQL older than 5.5.3 as they + # require the new utf8mb4 character set. Other DB servers are handling them + # without any problem. So we need to replace these characters if we use MySQL, + # else the comment is truncated. + # XXX - Once we use utf8mb4 for comments, this hack for MySQL can go away. + if (Bugzilla->dbh->isa('Bugzilla::DB::Mysql')) { + $thetext =~ s/([\x{10000}-\x{10FFFF}])/"\x{FDD0}[" . uc(sprintf('U+%04x', ord($1))) . "]\x{FDD1}"/eg; + } + ThrowUserError('comment_too_long') if length($thetext) > MAX_COMMENT_LENGTH; return $thetext; } |