Alex Lane's Corner of Texas


Home Who am I? PalmPilot Chess PGP Key *Code tips Links

Code & tips >> Perl scripts for Mac/PC character conversion

Disclaimer
All software available through this site is provided "as-is" and without warranty of any kind, express, implied, or otherwise, including without limitation, any warranty of merchantability or fitness for a particular purpose. You agree that in no event shall Alex Lane or Galexi Services be liable for any special, incidental, indirect or consequential damages of any kind, or any damages whatsoever resulting from loss of use, data or profits, whether or not advised of the possibility of damage, and on any theory of liability, arising out of or in connection with the use or performance of any software received from this site.

One of the perennial problems in working in Russian on Macs and PCs (particularly with Microsoft Word) is that the character mappings for the respective Mac and PC versions of Cyrillic don't match, (unless you're using mutually compatible fonts) which makes it difficult to move files from one platform to another.

I've developed two short scripts in Perl that appear to solve this problem. To use this solution, you must do the following:

  1. Save the Word file as an RTF (Rich Text Format) file.
  2. Execute the script using the following command line:
    perl [scriptname] <[sourcefile] >[targetfile]
    where [scriptname] is the name of the appropriate script (mac2pc.pl, which converts from Macintosh to PC, or pc2mac.pl, which goes the other way), [sourcefile] is the name of the respective Mac or PC RTF file you need to convert, and [targetfile] is the name of the respective PC or Mac RTF file that is to contain the correctly converted data. (Of course, if you don't have it, you'll need the latest version of Perl, too. You can find information and updates for Perl for Windows 95 at ActiveWare Internet Corp. Another useful resource is the Perl page at Yahoo.)
  3. Open the target RTF file on the target platform. Select all text and apply a "native" Mac or PC Cyrillic font.
Alternatively, you can make sure that you have a "Windows-compatible" font installed on your Mac.


(If the above date is a hundred years or so off, your browser's Java interpreter isn't current.)

© 1998-2000 by Alex Lane. Send mail to: alex@galexi.com.

Home | Who am I? | PalmPilot | Chess | PGP public key | Code & tips | Bookmarks