Persian users have historically had many problems with the level of Persian support on the Windows operating system.  I do not plan to go through a description of these problems in this article, but I would like to mention one serious problem: lack of the standard Persian keyboard.  The Persian Keyboard Layout exists as a national standard (ISIRI 2901:1994) and is supposed to be updated soon.

FarsiWeb has done an excellent job of providing the new layout as a keyboard driver for Windows, and made it available on SourceForge.  Unfortunately this keyboard driver has a small (but very annoying) problem, which is the Shift+Space combination.  Shift+Space is supposed to create a ZWNJ character (so that for example words such as می‌روم can be typed correctly), but using this keyboard driver, it only creates a normal space.

This is actually a bug in the MKLC tool used to build this driver.  MKLC is a proprietary tool available from Microsoft which allows users to define a keyboard layout visually, and creates a driver installation package from it.  MKLC has a bug which does not allow a character to be specified for the Shift+Space combination.  I had solved this problem with a bit of hacking back in 2004, and I'm publishing the details as well as the resulting keyboard driver (which handles Shift+Space correctly) here.  I had tried to submit this work to FarsiWeb guys so that they would update the driver on the SourceForge page, but unfortunately they didn't seem to be interested.

MKLC works like this: it generates a .c file containing the keyboard definition, and uses a stripped down version of the Visual C++ compiler which comes with it to compile this driver and link it against the necessary Windows libraries.  In order to intercept this process, I wrote a program called shim, which simply printed all of its command lines inside a file.  I then replaced the compiler executable coming with MKLC (cl.exe) with my shim.exe program and re-built the keyboard driver from within MKLC, which gave me some C source code to hack, plus the required commands to compile and build the driver.  I then modified the resulting Persian.c file to change the Shift state key code to 0x200C (which is the hex code for ZWNJ) and ran the compilation command manually, resulting in an installer which can be used to install the corrected driver.

You can grab the source and installer files below.  The installer is what most users want.  It has been tested on Windows XP and Vista.  After installing it, you should add a “Persian experimental standard” keyboard layout from the Regional and Language Options applet in the Control Panel.

Persian Keyboard Installer
Source Files

Update 1: It seems that the installer package cannot be installed on Windows Vista SP1 if UAC is enabled.  To work around this problem, you need to disable UAC before and after trying to install this package.

Update 2: I ported the hack to MKLC 1.4, which generates a setup package for all 64-bit flavors of Windows, including Itanium 64-bit, x64-64 and WoW64.  I have updated the download links for the new version.  If for some reason, you are interested in the older version, you can grab them below:

Persian Keyboard Installer (Note: older version — you probably want the newer version above.)
Source Files (Note: older version — you probably want the newer version above.)

Update 3: There is now an improved version of the keyboard layout available for download by Behnam Esfahbod.  You should really consider using this version of the keyboard.  I'm keeping the original version of the article for historical reference.