How to properly set up Win95/98/Me for KOI8-R

ATTENTION: A perfect solution for Win95/98/Me would be using KOI8-R<->CP1251 translation tables at the system level or inside each Internet or HTML related program (even this solution have some disadvantages, but nothing more fancy can be done in Win95/98/Me at this moment). Until this is implemented (I guess, after some critical mass of decoding programs is reached), a temporary solution is available here.

It is commendable that some programs support KOI8-R<->CP1251 translation automatically, but:

  1. Such programs are relatively rare (for example, Mozilla 1.7.3 , Opera 12 , MS Internet Explorer and MS Outlook Express Mail/News do it), a lot of interesting Internet software is unaware about the necessary decoding.
  2. Emulating KOI8-R via CP1251 can't be complete because character repertoires are different. Properly done, this would require UNICODE intermediation.
In this situation, it would be useful to have KOI8-R as the separate Code Page 878 (officially registered by IBM) for Win95, but this is beyond hacks and can be properly done only by Microsoft itself. At the moment of adding KOI8-R support Microsoft was unaware about CP878 registration by IBM and uses its own code page number 20866 to represent KOI8-R encoding. My solution amounts to just replacing the existing Central European decoding table with a KOI8-R table.

See also Notes on the Cp_20866.nls resource (for programmers).


As a matter of fact, we don't need KOI8-R fonts at all, as .TTF fonts from Microsoft are always in UNICODE , and we only need to make use of them. The only thing to do is to add KOI8-R -> UNICODE translation table as a resource to \Windows\System\gdi.exe. This resource is a simple array with 256 entries of word size: index is the ANSI code of character, value is the Unicode code. It is RC_DATA with ID=100..200, its name is stored in the corresponding string resource 1000+ID.

Step-by-step instructions for creating the KOI8-R translation resource

  1. Choose one of Red! already patched files:

    Download the file and unzip it in a temporary directory. Jump to step 3.

  2. If your system's gdi.exe size or type don't match any of the above, you need to patch your gdi.exe yourself using instructions from step 5 onwards. If you've got a successful result, please send me your patched gdi.exe zipped copy and I'll add it to those listed above.
  3. Reload Win95/98/Me in "command prompt only" (plain MS-DOS) mode, backup your old \Windows\System\gdi.exe and move the unpacked gdi.exe from temporary directory to \Windows\System\ (you can't just overwrite gdi.exe from inside Win95/98/Me because the file is in use or protected with PCHealth).

    WARNING: for WinMe you need to boot from Startup Diskette to get the "command line" prompt!

  4. Reboot the system again in Win95/98/Me mode and jump to step 10.
  5. Make a copy of your \Windows\System\gdi.exe and open this copy in Visual C++ 4.0 or Borland Resource Workshop 4.5.
  6. Choose the ID value 238 (Central European). Using this particular ID allows KOI8-R fonts to appear as Central European fonts (font names with CE suffix will be later changed to Font Name KOI8-R) for older programs such as Character Map or Microsoft Word 6.0.
  7. Overwrite this resource with the resource data below: (it conforms to Unicode translation table as per RFC 1489)
  8. Each Data ID has a corresponding string in the string table with ID + 1000 (for Central European it's 1238). That's what is shown in programs' font selection boxes, usually under the title of Script for Win95/98/Me Standard Edition or Набор символов for Win95 Russian Edition. Change the string to Russian (KOI8-R) for Win95/98/Me Standard Edition or to Русский (KOI8-R) for Win95 Russian Edition. You can download Borland Resource Workshop data (Script name) for Win95/98/Me Standard Edition or Borland Resource Workshop data (Набор символов name) for Win95/98/Me Russian Edition and paste it into the 1238 resource.
  9. Save, backup your \Windows\System\gdi.exe, restart the system in command prompt mode (this step is important), rename just saved copy to \Windows\System\gdi.exe and reboot your PC back to Win95/98/Me.
  10. Open \Windows\win.ini, find
     [FontSubstitutes] 
    section (or add one, if it's not present). Check all CE suffixes, this entries should look like:
     Arial CE,238=Arial,238 Arial CE,0=Arial,238 Courier New CE,238=Courier New,238 Courier New CE,0=Courier New,238 Times New Roman CE,238=Times New Roman,238 Times New Roman CE,0=Times New Roman,238 Arial Black CE,238=Arial Black,238 Arial Black CE,0=Arial Black,238 Impact CE,238=Impact,238 Impact CE,0=Impact,238 Verdana CE,238=Verdana,238 Verdana CE,0=Verdana,238 Lucida Sans Unicode CE,238=Lucida Sans Unicode,238 Lucida Sans Unicode CE,0=Lucida Sans Unicode,238 Haettenschweiler CE,238=Haettenschweiler,238 Haettenschweiler CE,0=Haettenschweiler,238 
    (not all of them may be present in your case).

    This provides access to KOI8-R fonts for old (Win3) programs that are unaware about font Scripts. Now you should remember that the CE suffix in the font list points to a KOI8-R font. E.g., choosing Times New Roman CE in WinWord will allow you to work with KOI8-R texts.

    WARNING for programmers: don't change CE suffix to something more appropriate (such as KOI8-R), some programs (e.g. WinWord) check if this suffix belongs to the list of known suffixes, so CE must remain in place as a provision for such (rare) cases.

  11. Save the file and reboot.
  12. Now launch any program with a font selection box, you'll find a Russian (KOI8-R) Script there, select it and enjoy.
  13. It's time now to set up the native Win95/98/Me keyboard driver for KOI8-R.

Great help on these matters was provided by Walter Kondrashov <Walt@gecko.crec.mipt.ru>, Alexander Smundak <sasha@whitelight.com>, and Vadim Burtyansky <burtyan@luckynet.co.il>, thanks.

See also the same issue for Win3.11, the same issue for WinNT, Notes on the Cp_20866.nls resource (for programmers), and How to set up the native Win95/98/Me keyboard driver for KOI8-R.