I copied Arabic text from a justified PDF and it came out with stretched letters nobody typed; how do I clean it?

Some layout programs justify Arabic lines to the page width by inserting the kashida or tatweel character (U+0640) inside words instead of widening the spaces, and when you copy text out of the file that character comes along. The fix is to paste the text into the tatweel remover with «Remove every tatweel»: the stretches disappear, the words and how they read do not change, and you can then tidy the spacing with the whitespace cleaner if needed.

Published · 3 min read

Where the stretches come from

Justifying Arabic text has two approaches: widen the spaces between words, or stretch the joins between letters inside words. The second often looks better in many fonts, and some layout programs do it by inserting real tatweel characters into the text. In the file the lines look neat and even, but the character is really there, and copying carries it across.

Not every file works this way. Some programs stretch letters visually without adding any character, and their text copies out clean. That is why one file from a source can have stretches while another from the same source has none.

Why it matters

Paste the text into your site or a product description and the stretched words will not match plain words in search. Paste it into a new editor with a different width and stretches show up in random places that no longer fit the line, because they were calculated for the original page width only.

An example

A line copied from a brochure: «نقدم لكم أفضل المنتجات», with a tatweel after the qaf in «نقدم» and another after the dad in «أفضل». After removal: «Tatweel found» 2, «Tatweel removed» 2, «Words affected» 2, and the line was back to a plain «نقدم لكم أفضل المنتجات». A whole brochure will give much bigger numbers, on the same principle.

Steps

  1. Copy the text from the PDF. If copying from your viewer scrambles the lines, try extracting the text with the PDF text extractor instead.
  2. Paste it into the Arabic tatweel remover and leave «Remove every tatweel» selected.
  3. Check the counters: a large «Tatweel found» with a similar «Words affected» means short stretches spread over many words, which is the typical justification pattern.
  4. Copy the result, then paste it into the Whitespace cleaner to even out spaces and collapse the runs of blank lines that PDF copying usually leaves.

Does removal change anything in the text?

Not the words and not how they are read. The tatweel is decorative and silent, and the tool deletes it alone, leaving letters, diacritics and digits untouched. Only the look changes: lines in your new editor will not appear justified the way they were in the original file. If you want justification again, let your new program calculate it for the new width.

One small caution: if the text comes from a teaching book with a tatweel that carries a vowel mark, such as a chart of diacritics, the tool keeps that one by default and tells you how many there are. Text copied from an ordinary document rarely has this case.

Common questions

Should I shorten runs instead of removing everything?

Not here. Nobody typed these stretches for decoration; the layout program added them for justification, so removing them all is the better choice.

Is the text from my file uploaded to a server?

No. The tatweel remover works inside your browser.