There is a problem with pure substr() that appeared in revision 1.85 (see
MDL-8184). The substr() can possibly produce XHTML parsing error - see an example:
substr('Marks & Spencer', 0, 9) -> 'Marks &am' ... is not XHTML compliance
I have already fixed, I am gong to commit in several minutes.