Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is a trick with Unicode RTL. The search query in the URL contains the character U+202E RIGHT-TO-LEFT OVERRIDE, followed by the searched-for text in normal (nonreversed) order.

Apparently Google ignores this character when searching for matches (so the matches are displayed normally), but the character appears when the query is reproduced in the search box at top of the screen, so the search string appears backwards.



This character is interesting, one more thing to watch out for in user-provided input. You do your homework and escape HTML in users' comments but if you don't escape the RTL overrides, their effects can "bleed" to other parts of the page, rendering it unreadable or at least hard to read.


The bleeding over seems to apply to Google's title. In my browser, it shows up as "xoferiF allizoM - hcraeS elgooG"...


Unicode Bidirectional Algorithm: http://www.unicode.org/reports/tr9/


Interesting character. You can copy & paste it in front of any text in an editable field and the text immediately flips.


Not only that, but the entire directionality of the text box does to. E.g. arrowing right and left is flipped as well.


Bingo. I wish I had a price for you.


s/price/prize/





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: