Convert Windows-1251, KOI8-R and CP866 to UTF-8

You got a file from a Russian customer, colleague or old system, and it shows Ïðèâåò or only �? It’s most likely saved in Windows-1251 (cp1251). Drop the file in – Mojibuster detects the character set and converts it to 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 you need this

  • Exports from 1C, Russian banking clients or accounting software come in Windows-1251, but your system only accepts UTF-8.
  • Old Russian websites, forums, emails and logs are stored in Windows-1251 or KOI8-R.
  • Windows console output or old .bat files in CP866 look like ЏаЁўҐв.
  • Russian .srt subtitles are often saved in Windows-1251 – so the TV shows � or Ïðèâåò. More on broken subtitles.
  • Database backups and exports from old CMS installations set up before the switch to UTF-8.
Russian text in Windows-1251, opened with Western settings

Garbled

Ìîñêâà, óë. Òâåðñêàÿ 7
Òåëåôîí: +7 495 123-45-67

After converting

Москва, ул. Тверская 7
Телефон: +7 495 123-45-67

What garbled Russian text looks like

The broken text often tells you what went wrong. Here is the Russian word Привет (“hello”) after different mistakes:

  • Ïðèâåò – Windows-1251 opened as Western Windows-1252: on a Mac, in an English program or in an old media player.
  • рТЙЧЕФ – KOI8-R read as Windows-1251. Typical for old emails and Unix archives.
  • оПХБЕР – the other way round: Windows-1251 read as KOI8-R.
  • ЏаЁўҐв – a DOS file in CP866 opened as Windows-1251.
  • ╧ЁштхЄ – Windows-1251 in a Windows console running CP866, e.g. after type file.txt in cmd.
  • Привет – not an old character set, but UTF-8 read as Windows-1251. This is how a CSV in Excel usually looks on a Russian Windows system.

You can paste such text into the box above – Mojibuster turns it back into Привет. For console output (╧ЁштхЄ), dropping the original file works more reliably.

How to convert

  1. Drag the file into the box above.
  2. Mojibuster detects Windows-1251, KOI8-R, CP866 and UTF-8 on its own. The result shows which character set it used.
  3. If the preview looks wrong, read the file again with one click on Read as ….
  4. Click Download to save the file as UTF-8.

Windows-1251 is also used for Ukrainian, Belarusian, Bulgarian, Serbian and Macedonian. Detection is tuned for Russian text, so with other languages check the preview – and use Read as … if letters look off.

Convert on the command line

For many files or for scripts, standard tools work. On Linux and macOS: iconv -f CP1251 -t UTF-8 in.txt > out.txt. For KOI8-R use -f KOI8-R, for DOS files -f CP866.

In PowerShell 7: Get-Content in.txt -Encoding windows-1251 | Set-Content out.txt -Encoding utf8. In the older Windows PowerShell 5.1, Default only means Windows-1251 on a Russian Windows system – on English Windows it means Windows-1252, so use PowerShell 7.

Keep in mind: these commands don’t guess the character set. Pick the wrong one and you get new garbled text. Mojibuster checks the options for you.

How the character sets differ

Windows-1251 (cp1251) is the standard character set of Russian Windows. KOI8-R was used on Unix and in email: its Russian letters are arranged so that, read the wrong way, the text looks like Latin letters with mixed-up case (рТЙЧЕФ). CP866 is the character set of DOS and the Windows console. For Mojibuster it doesn’t matter: it tries all three and picks the right one.

What can’t be restored

Characters that have already turned into ? are gone: the information was lost when the file was saved. Mojibuster shows how many there are. How these errors happen in the first place: what mojibake is.

A typical case is ?????? instead of Привет: the file was once saved in a character set without Cyrillic, such as ASCII or Latin-1. The same goes for ? and � that are already stored in the file – they stay after converting. But � that only appears on screen is usually harmless: the file is probably in Windows-1251, so drop the original file here.

Frequently asked questions

Can I open the file in Excel afterwards?

Yes. For CSV files, keep Save with BOM switched on – then Excel opens the file with the Cyrillic letters intact. More on CSV files in Excel.

Can I convert back from UTF-8 to Windows-1251?

Not yet – files are only saved as UTF-8. If you need Windows-1251, save the file again in Excel or a text editor.

Is my file uploaded to a server?

No. The conversion runs entirely in your browser.

How do I find out which character set a file uses?

Drop it into the box: Mojibuster shows how the file was read and offers other readings. In Windows Notepad and Notepad++, the character set is shown in the status bar at the bottom. If the text contains URL codes like %D0%96, you can decode those too.

Does this work for Ukrainian or Bulgarian files?

Usually yes, since they also use Windows-1251. Detection is tuned for Russian, so check the preview. If it looks wrong, Mojibuster offers another reading with one click.

More guides