Article written by

A passionate pythonist geek looking for problems, to solve :P

25 responses to “Python Arabic Text Reshaper”

  1. Khaled

    بارك الله فيك اخي عبدالله
    أرجو ان يساعدني هذا في العديد من الامور التي لا تدعم اللغة العربية
    أتمنى أن نتواصل على الايميل

  2. Louis

    Hello Abd,
    Thank you for this *extremely* valuable port. Quick question, regarding “single letters”.
    Your algorithm reshapes an isolated letter, such as ض (\u0636) into a shaped one : ﺿ (\uFEBF).
    I don’t think this is correct (?) I consider adding a line of code at the very first line of the function “get_reshaped_word” to exclude 1-letter words. Would it make sense?

    def get_reshaped_word(unshaped_word):
    if len(unshaped_word) == 1: return unshaped_word ### <—– New
    unshaped_word = replace_lam_alef(unshaped_word)
    decomposed_word = DecomposedWord(unshaped_word)

  3. waleed

    بارك الله فيك
    شغالة معايا تمام

  4. Cüneyt Sina Koca

    Thanks for this project, just wanted to inform that my problems regarding the error :

    UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-4: ordinal not in range(128)

    is solved by putting the following lines in :

    import sys

  5. Mohamed LICHOURI

    In first, thanks for sharing this code, but i have a problem with the example that you provided.

    NameError: name ‘pass_arabic_text_to_render’ is not defined

  6. Razan

    Assalam Alykum

    Thank you brother for your great effort and sharing it , Now i can finally use beautiful arabic fonts in Linux for OpenERP arabic Reports.
    which the was suggested as a part of solution for OpenERP arabic reports in

    i have noticed that there is vertical alignment Problem when generating the reports . the data is not vertically well aligned. am just asking is this issue related to the reshaper or to the Reportlab represntation for the arabic font.

    note that before i use the solution in the link [ ] some fonts were well aligned but they have the square thing issue , now they are ok but not well aligned vertically !!!

  7. Razan

    Thanks in advance :)

  8. Marek


    I’m using your module together with bidi and it’s clear the arabic text itself is correct and well wrapped whether in console or in text editor. However I need to render Arabic text properly as Paragraph entity in Reportlab, but I’m only facing a problem with word wrap (RTL text is wrapped, but with new line above, not under). How did you passed through this?

    best regards and thanks for your effort

  9. egamal

    السلام عليكم
    تظهر مشكله عند طباعه جمله طويله في اكتر من سطر

  10. Amine

    Thank you so much, really a wonderful job, thanks thanks thanks

  11. Josh

    Thank you for this extremely valuable port, which helped generate printed registration rolls for over a million voters in Libya.

    There is a minor bug with the lam-alef glyphs, which appears to be from the original Java package, as I have noted in GitHub issue #2.

    We have also mirrored the RTL branch of reportlab to GitHub, in case others would like to use it without installing mercurial.

  12. Yashar Bazli

    Hi Bro.
    How i can to install it ?!
    thank you

Leave a Reply