Create a wiki page with a » character ('RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK' (U+00BB)) in its title. Then search for that page. In the preview there will be » in the title because it was escaped twice.
HtmlImpl.escape escapes the » but HtmlImpl.unescape doesn't unescape it.
Since StringUtil.highlight first unescapes the input and later escapes it this leads to a double escaped character.
I assume that the same happens for other character that are escaped but not unescaped.
In my opinion HtmlUtil.escape should escape exactly the things that HtmlUtil.unescape unescapes.