Persian RTL Direction Fixer

Fix bidi rendering for Persian text pasted into LTR environments

Fix mangled bidirectional rendering of Persian text in left-to-right environments by wrapping it in Unicode direction controls (RLI/PDI, RLE/PDF, or RLM). Strips existing controls first so wrapping is idempotent. Runs entirely in your browser.

Why does Persian text render in the wrong order?

When right-to-left text sits in a left-to-right host such as a code comment or a CSV cell, the bidirectional algorithm can reorder punctuation, numbers, and embedded Latin incorrectly. Direction controls tell the host to display the run right-to-left.

Fix Persian text that renders backwards

Persian is right-to-left, but many editors, spreadsheets, and chat boxes default to left-to-right. Pasting Farsi there can scramble the order of punctuation, numbers, and embedded Latin. This tool wraps your text in Unicode bidirectional controls so it renders correctly anywhere.

How it works

The fixer first removes any existing bidi format characters, then wraps the clean text in the controls for the method you pick:

  • RLI…PDI (U+2067…U+2069) — Right-to-Left Isolate. The modern, recommended approach; it isolates the run so it does not disturb neighbouring text.
  • RLE…PDF (U+202B…U+202C) — Right-to-Left Embedding. A legacy embedding with the widest compatibility.
  • RLM (U+200F) — a Right-to-Left Mark prefix, the lightest hint when a full wrapper is overkill.

Because existing controls are stripped first, the operation is idempotent — running it again will not pile up extra characters.

Example and notes

A string like قیمت: 1500 تومان (Persian) often shows the number and parentheses in the wrong place inside an LTR field. Wrapping it with RLI…PDI keeps the whole run right-to-left while leaving the visible characters untouched. The tool reports how many invisible control characters were added so you know the wrapper is present.

All processing is local — your text never leaves the browser.