diff options
author | wurblzap%gmail.com <> | 2006-01-23 06:37:37 +0100 |
---|---|---|
committer | wurblzap%gmail.com <> | 2006-01-23 06:37:37 +0100 |
commit | 3d2aaa5d315ff77d416eac52eebfc5ae857126b4 (patch) | |
tree | 0e16143cf567a135bbca2d689ae3de688ce3f3ca | |
parent | 501cc533070b8c4366ae0d59e40a166a5f9452dc (diff) | |
download | bugzilla-3d2aaa5d315ff77d416eac52eebfc5ae857126b4.tar.gz bugzilla-3d2aaa5d315ff77d416eac52eebfc5ae857126b4.tar.xz |
Bug 319331: mailto link generated with BiDi user name and email address gets mangled with timestamp.
Patch by Marc Schumann <wurblzap@gmail.com>,
r=justdave, r(char list)=smontagu, a=justdave
-rw-r--r-- | Bugzilla/Template.pm | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 7dfb5c539..08bcfacdf 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -461,11 +461,41 @@ sub create { # Format a time for display (more info in Bugzilla::Util) time => \&Bugzilla::Util::format_time, - # Override html filter to obscure the '@' in user visible strings - # See bug 120030 for details + # Bug 120030: Override html filter to obscure the '@' in user + # visible strings. + # Bug 319331: Handle BiDi disruptions. html => sub { my ($var) = Template::Filters::html_filter(@_); + # Obscure '@'. $var =~ s/\@/\@/g; + if (Param('utf8')) { + # Remove the following characters because they're + # influencing BiDi: + # -------------------------------------------------------- + # |Code |Name |UTF-8 representation| + # |------|--------------------------|--------------------| + # |U+202a|Left-To-Right Embedding |0xe2 0x80 0xaa | + # |U+202b|Right-To-Left Embedding |0xe2 0x80 0xab | + # |U+202c|Pop Directional Formatting|0xe2 0x80 0xac | + # |U+202d|Left-To-Right Override |0xe2 0x80 0xad | + # |U+202e|Right-To-Left Override |0xe2 0x80 0xae | + # -------------------------------------------------------- + # + # The following are characters influencing BiDi, too, but + # they can be spared from filtering because they don't + # influence more than one character right or left: + # -------------------------------------------------------- + # |Code |Name |UTF-8 representation| + # |------|--------------------------|--------------------| + # |U+200e|Left-To-Right Mark |0xe2 0x80 0x8e | + # |U+200f|Right-To-Left Mark |0xe2 0x80 0x8f | + # -------------------------------------------------------- + # + # Do the replacing in a loop so that we don't get tricked + # by stuff like 0xe2 0xe2 0x80 0xae 0x80 0xae. + while ($var =~ s/\xe2\x80(\xaa|\xab|\xac|\xad|\xae)//g) { + } + } return $var; }, |