Documents and Office

Clean Persian Text: ی and ک, Half-Spaces and Punctuation

Why Persian text breaks: Arabic ي and ك, missing half-spaces (ZWNJ), Latin punctuation, mixed digits and wrong keyboards, and how to fix it.

Saizul Amin
Saizul Amin29 Oct 2026 · 3 min read
Clean Persian Text: ی and ک, Half-Spaces and Punctuation

Clean Persian Text: ی and ک, Half-Spaces and Punctuation

Persian text that looks fine on screen can still be broken underneath. Search engines miss words, sorting goes wrong, lines break in odd places and printed pages look careless. Most of the problems come from a handful of characters. The Persian Keyboard Layout Fixer and Text Normaliser finds and fixes them.

Problem 1: Arabic letters in Persian text

Arabic and Persian share most letters, but two common ones have separate Unicode characters:

ArabicPersianName
ي (U+064A)ی (U+06CC)yeh
ك (U+0643)ک (U+06A9)kaf

On screen they look almost the same, especially in the middle of a word. A search for "کتاب" will not find "كتاب". Text typed on an Arabic keyboard, copied from Arabic sources or from older software often has the Arabic forms. The normaliser replaces them with the Persian letters.

Problem 2: half-spaces

Persian uses the zero-width non-joiner, called nim-fasele (نیم‌فاصله), to stop two letters from joining without leaving a full gap. It belongs in:

  • the verb prefixes می and نمی: می‌خواهم، نمی‌دانم
  • plural and comparison suffixes: کتاب‌ها، کتاب‌های، بزرگ‌تر، بزرگ‌ترین
  • endings after a final ه: خسته‌ام، خانه‌ای، رفته‌است

People without a half-space key type a normal space or nothing at all. A full space splits one word into two at the end of a line; no space glues the parts into the wrong shapes. The tool inserts half-spaces where the rule is safe, that is where a space separates می or نمی from a verb, or a word from one of the suffixes. Words that simply begin with می, like میز (table) or میهن (homeland), are left alone because there is no space after می.

Problem 3: punctuation

Persian has its own comma ،, semicolon ؛ and question mark ؟. A Latin comma or question mark after Persian words looks out of place and may sit on the wrong side in right-to-left text. The tool replaces them when they follow Persian letters, removes spaces before punctuation and adds one after it.

Problem 4: digits and tatweel

Digits may come in Latin, Arabic-Indic or Persian forms in one paragraph. The normaliser can turn them all into Persian digits. It also removes tatweel (ـ), the stretching line used to make words longer, which breaks searches.

Problem 5: the wrong keyboard

If you started typing with the keyboard set to English, a Persian sentence comes out as Latin letters. The keyboard fix maps every key of the standard Persian layout (ISIRI 9147) to its letter, so "sghl" turns back into "سلام".

A worked example

Input: "مي خواهم كتاب ها را بخوانم ,اما نمي دانم كجا هستند ?"

Output: "می‌خواهم کتاب‌ها را بخوانم، اما نمی‌دانم کجا هستند؟"

The Arabic yeh and kaf became Persian letters, the half-spaces went into می‌خواهم، کتاب‌ها and نمی‌دانم, and the comma and question mark became Persian.

Seeing the invisible

A half-space is invisible. Pick "Show half-spaces as ¦" to see each one, then switch back. The counts under the editor show how many Arabic letters, half-spaces and digits of each kind the text contains.

For developers and editors

Normalise Persian text once, before you store or index it, and normalise search queries the same way. Keep a copy of the original if the text is a legal record. Removing short-vowel marks (harakat) is useful for search but not for poetry or the Quran, so it is off by default.

Limits

The rules handle common grammar, not every compound word or name; check those by eye. Your text is processed only in your browser.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages