Take a look at the following text, looks normal enough doesn’t it?
“Harry ”.draziw a si Potter
Now, try to select the text and see what happens.
WHAT WITCHCRAFT IS THIS?!
If you examine the source code for this page, you’ll see that I’m using the Unicode Bi-Directional characters.
"Harry ‮".draziw a si ‭Potter
These characters are useful when writing text that includes, say, English and Arabic – but they can also be used for malicious purposes.
On a more mundane level, they can cause all sorts of UI bugs. I’ve just filed a bug against the Chrome browser for how it handles these characters.
If you right click on text with mixed direction, you’ll notice that the UI behaves oddly.
In Firefox, the behaviour is correct – although one could argue whether “Potter” ought to be reversed.
So, what happens when we run these searches?
Neither Firefox nor Chrome do particularly well. I’m not sure if the reversed text in the window title and URL bar are bugs in Ubuntu – or whether it’s the fault of the app itself.
On Windows and Mac, we see this happen:
This would suggest that Google isn’t correcting the direction of the text and that is deforming its own title tags.
Are These Bugs?
Ok, so having the title reversed isn’t the worst problem in the world. But do these examples count as bugs and, if so, who is responsible for them?
Every search engine I tried passed through the right-to-left-over-ride unscathed – so that’s the fault of the search engine, right? How the hell do you a report a bug to Google?
The title bar could either be a problem with the browser – Firefox has a bug report over a year old on the issue – or the problem could be with the underlying operating system. How would one find out?
Thanks to Yuan Phoon for asking the questions which prompted this discovery.