PHP: Ascii to Mac Roman

A little function to transform an ascii string into a Mac Roman string suitable for MacOS Pre X

function AsciiToMacRoman($str)
{ 
  return strtr($str, 
  "xc4xc5xc7xc9xd1xd6xdcxe1xe0xe2xe4xe3 
   xe5xe7xe9xe8xeaxebxedxecxeexefxf1xf3 
   xf2xf4xf6xf5xfaxf9xfbxfcxb0xa7xb6xdfxae 
   xb4xa8xc6xd8xa5xaaxbaxe6xf8xbfxa1xac 
   xabxbbxa0xc0xc3xf7xffxa4xb7xc2xcaxc1 
   xcbxc8xcdxcexcfxccxd3xd4xd2xdaxdb 
   xafxb8x22x22x27x27", 
  "x80x81x82x83x84x85x86x87x88x89x8ax8b 
   x8cx8dx8ex8fx90x91x92x93x94x95x96x97 
   x98x99x9ax9bx9cx9dx9ex9fxa1xa4xa6xa7 
   xa8xabxacxaexafxb4xbbxbcxbexbfxc0xc1 
   xc2xc7xc8xcaxcbxccxd6xd8xdbxe1xe5xe6 
   xe7xe8xe9xeaxebxecxedxeexefxf1xf2xf3 
   xf8xfcxd2xd3xd4xd5"); 
 }

Leave a Reply

Your email address will not be published. Required fields are marked *


*