Arabic and right-to-left
How Fetlar handles Arabic and other right-to-left text when reading, writing, comparing and searching.
Arabic and right-to-left text is handled the same way everywhere in Fetlar. It is never reordered and never mangled.
Reading
- Text comes out in logical order, as it is stored. Fetlar does not reverse it.
- Lists keep their real labels, including Arabic letters (abjad) and Hindi-Arabic digits.
- Right-to-left tables are written as HTML tables in Markdown, with
dir="rtl", because a pipe table cannot mark direction. - Excel number formats work in Arabic locales, including Hijri calendars and Arabic-Indic digits.
--normalize llmremoves diacritics, tatweel and invisible characters, and folds presentation forms. Use it before sending text to a language model.
fetlar r.xlsx## ورقة
<table dir="rtl">
<thead>
<tr><th>البند</th><th>المبلغ</th></tr>
</thead>
<tbody>
<tr><td>رواتب</td><td>1,250</td></tr>
</tbody>
</table>With --normalize llm, a heading such as 4.2 مدّة العقد becomes 4.2 مدة العقد.
Writing
Set "rtl": true on a document, sheet, paragraph, run or table. Lists can number in Arabic letters (arabicAbjad) or Hindi-Arabic digits (hindiNumbers).
{
"kind": "docx",
"properties": {"title": "تقرير", "author": "المالية"},
"blocks": [
{"type": "heading", "level": 1, "text": "خطة الطوارئ", "rtl": true},
{"type": "list_item", "ordered": true, "num_format": "hindiNumbers", "text": "البند الأول", "rtl": true},
{"type": "table", "rtl": true, "header_rows": 1, "rows": [["المسؤول", "الهاتف"], ["مدير الأمن", "0112345678"]]}
]
}Bold, size and fonts are set for complex-script text too.
Word for Mac shows hindiNumbers as Devanagari digits. LibreOffice shows 1 2 3. The digit script is the viewer's choice.
For CSV, keep the byte order mark (the default) so Excel reads Arabic correctly. For anything important, write .xlsx.
Templates
An Arabic value put into a Latin run gets Arabic bold, italic and size. Placeholder names may be Arabic: {{اسم}}. Dates can be Hijri (Umm al-Qura, as Excel computes it) and Gregorian. Digits can be Arabic-Indic. See Templates.
Comparing
Text is compared as stored. Reports give Arabic text right-to-left paragraphs. See Comparing files.
Searching
Search folds Arabic spelling, so you find a word however it was typed: احمد finds أحمد, and ٦٠ finds 60. See Search.
CSV in Arabic encodings
Old CSV files saved as Windows-1256 are detected and read as Arabic. UTF-8 and UTF-16 (with a byte order mark) work too.