Wednesday, May 8, 2013

A tool for working with bi-directional text



working with bi-directional text can be ...um... interesting.  Ok, bloody frustrating.  Especially on a Mac.

At times I've found it necessary to use the unicode bi-directional formatting characters in order to get certain combinations of English and Arabic to display properly in Flex.  (btw, If you don't know what bi-directional formatting characters are,  there's a great explanation at http://www.iamcal.com/understanding-bidirectional-text/)  Unfortunately, those are zero-width characters, which makes them difficult to deal with in a standard text editor.

So I made myself a little tool that makes it easy to detect and insert bi-directional formatting characters in a block of text.  It's not what I would call slick, but I've found it helpful, so maybe someone else will too.  You can give it a try here: http://www.dougmccluer.com/bidiedit/

Basically you paste some text in the top box and in the bottom it will display all the unicode codes for each character.  The bidirectional formatting characters are called out in the bottom box with a special syntax.  You can switch between LTR and RTL display, and surround a selected run of text with the bidi-formatting characters of your choice.

If you know of a good cross-platform app for controlling the appearance of bi-directional text on a line-by-line basis, let me know in the comments!

No comments:

Post a Comment