unicode - Is there any way to reverse text and *character* direction in a pure text document?

08
2014-07
  • Elias Mossholm

    I have some text in Latin script (English transcription of Farsi) that I would like to display right-to-left in ordinary text documents (and on my iPod) – is that possible? How?

    Here’s an example of some text I’d like to reverse (the second row):

    تو آسمون عشقم تو بودی ستاره ی من تو بودی
    To asemoone eshqam to budi, Setareye man to budi
    

    I first tried some online text mirroring tools but they either just place the letters in reverse order without mirroring them (idub ot nam eyerateS ,idub ot maqhse enoomesa oT) or replace them with other characters that may or may not resemble a mirror image of the original characters (ibud oƚ nɒm ɘyɘɿɒƚɘƧ ,ibud oƚ mɒpʜƨɘ ɘnoomɘƨɒ oT). Both solutions produced text that was (to me) more difficult to read than truly mirrored text.

    I then tried adding right-to-left unicode marks (U+200E) after every character but that also just reversed the order of the characters, not the characters themselves (‏‏‏‏no example available, the effect is erased when pasted into superuser.com, but it looks like the first online example above).

    Why would you want to do something like this? – In my case I have some song texts in Farsi with English transcription and it would be very helpful if the transcription flowed like the original text so that I can follow them simultaneously.

  • Answers
  • Jukka K. Korpela

    Reversing text direction is possible in plain text, using control characters for the purpose. But the body of the question (unlike the title) also refers to mirroring of characters. Then the answer is negative. For most characters, there is no corresponding mirrored character, since such characters are not used in any normal writing system.

  • TheUser1024

    If what the site you linked creates is good enough for your purposes (as you can see in the alphabet below it has limits), you might do it like this:

    Create a script that does 52 find and replace operations on your text(s) replacing

    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
    

    with

    ƸYXWVUTƧЯỌꟼOИM⅃ᐴႱIHᎮᖷƎᗡƆᙠAzyxwvuƚƨɿpqonmlʞႱiʜǫʇɘbɔdɒ
    

    I have serious doubts though, that this is a better solution even than learning to read the reversed text. That's up to you i guess. Funny though how many unicode characters there are, that are mirrored latin letters.


  • Related Question

    hebrew - Know of any invisible right-to-left characters in Unicode?
  • Andrew J. Brehm

    A common problem with right-to-left text and many text editors is that while the actual right-to-left characters are written right-to-left, the punctuation (nominally) following such a sentence is switched back to left-to-right mode again.

    This results in, for example, Hebrew text not followed but preceeded by a question mark.

    The problem can be dealt with by adding another right-to-left character after the punctuation. But that is certainly not a good solution.

    So I am wondering whether there is an invisible right-to-left character in Unicode that I could add after punctuation at the end of right-to-left text in order to get the effect of adding another character but not the sight of it.

    Any ideas?

    Or any other ideas to solve the problem?


  • Related Answers
  • TRS-80

    Does U+200F "RIGHT-TO-LEFT MARK Right-to-left zero-width character" work? There's a few others listed at UAX #9: Unicode Bidirectional Algorithm.

  • macarthy

    I believe that openoffice allows you to do this (Add the zero-width space) with a SPACE bar + one of the Meta keys. This is certainly the case in Lao and Thai scripts.