Convert Windows-1256 to UTF-8 (Arabic)

You got a file from an Arabic customer, colleague or old system, and it only shows � on your Mac, on Linux or in your code editor? It is most likely saved in Windows-1256, also called cp1256 or Arabic ANSI. Drag it here: Mojibuster detects the encoding and saves the file as UTF-8.

Works with text and these files:

  • CSV
  • TXT
  • JSON
  • XML
  • SRT
  • VTT
  • SMI
  • TSV
  • MD
  • HTML
  • SQL
  • LOG

For example Excel exports, database dumps, subtitles or website code.

Repair

  1. Drop a file or paste text
  2. It gets repaired automatically
  3. Copy or download
or simply drag a file here

When do you need to convert?

  • Exports from Arabic accounting, government or banking software in Windows-1256 that must go into a system that only accepts UTF-8.
  • Old Arabic websites, databases, forums and subtitle files saved in Windows-1256.
  • A file saved in Notepad as “ANSI” on an Arabic Windows PC and then opened in an editor or program that expects UTF-8.

Where do Windows-1256 files come from?

Windows-1256 is the “ANSI” code page of Arabic Windows, or of any Windows where the language for non-Unicode programs is set to Arabic in the region settings. Every program that saves text in the system’s default encoding then writes Windows-1256 files:

  • Notepad in older Windows versions – it saved as ANSI by default until about 2019.
  • Excel when saving as plain CSV (Comma delimited).
  • Older accounting and inventory software and databases set to cp1256.
  • Arabic subtitle files, websites and forums from the last twenty years.
Windows-1256 text opened with Western settings

Broken characters

ÔÇÑÚ ÇáÊÍÑíÑ 12¡ ÇáÞÇåÑÉ
ÇáåÇÊÝ: +20 2 1234 5678

After converting

شارع التحرير 12، القاهرة
الهاتف: +20 2 1234 5678

What do the letters look like when read wrong?

In Windows-1256 every Arabic letter is one byte. When a Western program reads that byte as Windows-1252, you see a Latin letter with an accent:

  • ا → byte C7 → Ç
  • ب → byte C8 → È
  • ع → byte DA → Ú
  • ل → byte E1 → á
  • م → byte E3 → ã
  • ي → byte ED → í

That’s why السلام turns into ÇáÓáÇã. You can paste such text straight into the box, and Mojibuster turns it back into Arabic.

How to convert

  1. Drag the file into the box above.
  2. Mojibuster detects Windows-1256 and UTF-8 automatically and shows which encoding it used to read the file.
  3. Click Download to save the file as UTF-8.

Windows-1256 is used for Arabic, and also for Persian and Urdu files. Not every file is read equally well. If the preview looks wrong, Mojibuster offers another reading with one click. Greek and Hebrew have their own code pages: Windows-1253 and Windows-1255.

Windows-1256 vs. ISO-8859-6

Windows-1256 is the common code page of Arabic Windows. It contains the Arabic letters plus some Persian and Urdu letters. ISO-8859-6 is older, less common and puts the letters in other positions. ISO-8859-6 files are rare today, so Windows-1256 is the usual starting point.

In both code pages the first letters from ء to ض sit in the same positions; after that they differ. So an ISO-8859-6 file read as Windows-1256 shows wrong Arabic letters mixed with some Latin ones – ل, for example, becomes ن. ISO-8859-6 also lacks Persian letters such as پ, چ and گ, which Windows-1256 has.

Converting on the command line

To convert many files at once on Linux or Mac, this command is enough:

iconv -f CP1256 -t UTF-8 in.txt > out.txt

And in PowerShell 7 on Windows:

Get-Content -Encoding 1256 in.txt | Set-Content -Encoding utf8 out.txt

Note that these commands assume you know the file’s encoding. If the file is already UTF-8, you get new garbage such as ط§ظ„. Mojibuster checks the file first and only converts it if the result is clean Arabic text.

What can’t be recovered?

Letters that turned into ? can’t be restored, because the information was lost when the file was saved. Mojibuster shows how many there are.

The same goes for characters that Windows-1256 doesn’t have at all, such as emoji and letters of some other languages: when the file is saved as ANSI, they become ? for good. If you see � in a modern editor, the letters are still in the original file and can be converted.

Frequently asked questions

Can I open the file in Excel after converting?

Yes. For CSV files keep Save with BOM switched on, and Excel opens the file without broken characters. Details in fixing Arabic CSV files in Excel.

How do I know the file is Windows-1256?

If the text shows Latin letters with accents like ÇáÓáÇã, or � in an editor that expects UTF-8, it’s most likely Windows-1256. After reading, Mojibuster shows which encoding it detected. If the text shows codes like %D3%E1%C7%E3 (URL codes), paste them into the tool.

Does Windows-1256 support Persian and Urdu?

It contains the Persian letters and many Urdu letters. So old Persian files are converted the same way – see the Persian page.

Can I convert from UTF-8 to Windows-1256?

Right now the file is only saved as UTF-8. If you need Windows-1256, save the file again in Excel or your text editor.

Is the file uploaded to a server?

No. The conversion runs entirely in your browser.

More guides