diff -Nur Spreadsheet_Excel_Writer-0.9.1.orig/Writer/Format.php Spreadsheet_Excel_Writer-0.9.1/Writer/Format.php
--- Spreadsheet_Excel_Writer-0.9.1.orig/Writer/Format.php	2005-11-09 08:29:35.000000000 +0800
+++ Spreadsheet_Excel_Writer-0.9.1/Writer/Format.php	2008-06-21 14:46:35.197569488 +0800
@@ -243,16 +243,23 @@
     var $_right_color;
 
     /**
+    * input encoding for unicode
+    * @var string
+    */
+    var $_input_encoding;
+
+    /**
     * Constructor
     *
     * @access private
     * @param integer $index the XF index for the format.
     * @param array   $properties array with properties to be set on initialization.
     */
-    function Spreadsheet_Excel_Writer_Format($BIFF_version, $index = 0, $properties =  array())
+    function Spreadsheet_Excel_Writer_Format($BIFF_version, $index = 0, $properties =  array(), $input_encoding = '')
     {
         $this->_xf_index       = $index;
         $this->_BIFF_version   = $BIFF_version;
+        $this->_input_encoding = strtoupper($input_encoding);
         $this->font_index      = 0;
         $this->_font_name      = 'Arial';
         $this->_size           = 10;
@@ -455,12 +462,22 @@
         $bCharSet   = $this->_font_charset; // Character set
         $encoding   = 0;                    // TODO: Unicode support
 
-        $cch        = strlen($this->_font_name); // Length of font name
         $record     = 0x31;                      // Record identifier
         if ($this->_BIFF_version == 0x0500) {
+            $cch        = strlen($this->_font_name); // Length of font name
             $length     = 0x0F + $cch;            // Record length
         } elseif ($this->_BIFF_version == 0x0600) {
-            $length     = 0x10 + $cch;
+            if ($this->_input_encoding != '') {
+                $encoding   = 1;
+                if ($this->_input_encoding != 'UTF16-LE')
+                    $this->_font_name = mb_convert_encoding($this->_font_name, "UTF-16LE");
+                $cch        = mb_strlen($this->_font_name, "UTF-16LE");
+                $length     = 0x10 + strlen($this->_font_name);
+            }
+            else {
+                $cch        = strlen($this->_font_name); // Length of font name
+                $length     = 0x10 + $cch;            // Record length
+            }
         }
         $reserved   = 0x00;                // Reserved
         $grbit      = 0x00;                // Font attributes
diff -Nur Spreadsheet_Excel_Writer-0.9.1.orig/Writer/Workbook.php Spreadsheet_Excel_Writer-0.9.1/Writer/Workbook.php
--- Spreadsheet_Excel_Writer-0.9.1.orig/Writer/Workbook.php	2008-06-21 14:43:03.619511000 +0800
+++ Spreadsheet_Excel_Writer-0.9.1/Writer/Workbook.php	2008-06-21 14:46:43.421493326 +0800
@@ -172,6 +172,12 @@
     var $_string_sizeinfo_size;
 
     /**
+    * input encoding for unicode sheetname
+    * @var string
+    */
+    var $_input_encoding;
+
+    /**
     * Class constructor
     *
     * @param string filename for storing the workbook. "-" for writing to stdout.
@@ -266,14 +272,17 @@
     * @access public
     * @param integer $version The BIFF version
     */
-    function setVersion($version)
+    function setVersion($version, $input_encoding = '')
     {
         if ($version == 8) { // only accept version 8
             $version = 0x0600;
             $this->_BIFF_version = $version;
+            $this->_codepage = 0x04B0;
             // change BIFFwriter limit for CONTINUE records
             $this->_limit = 8228;
+            $this->_input_encoding = strtoupper($input_encoding);
             $this->_tmp_format->_BIFF_version = $version;
+            $this->_tmp_format->_input_encoding = $this->_input_encoding;
             $this->_url_format->_BIFF_version = $version;
             $this->_parser->_BIFF_version = $version;
 
@@ -287,6 +296,7 @@
             // change version for all formats too
             for ($i = 0; $i < $total_formats; $i++) {
                 $this->_formats[$i]->_BIFF_version = $version;
+                $this->_formats[$i]->_input_encoding = $this->_input_encoding;
             }
         }
     }
@@ -361,7 +371,7 @@
     */
     function &addFormat($properties = array())
     {
-        $format = new Spreadsheet_Excel_Writer_Format($this->_BIFF_version, $this->_xf_index, $properties);
+        $format = new Spreadsheet_Excel_Writer_Format($this->_BIFF_version, $this->_xf_index, $properties, $this->_input_encoding);
         $this->_xf_index += 1;
         $this->_formats[] = &$format;
         return $format;
@@ -640,7 +650,11 @@
         $total_worksheets = count($this->_worksheets);
         // add the length of the BOUNDSHEET records
         for ($i = 0; $i < $total_worksheets; $i++) {
-            $offset += $boundsheet_length + strlen($this->_worksheets[$i]->name);
+            if ($this->_input_encoding != 'UTF-16LE' && $this->_input_encoding != '')
+                $name = mb_convert_encoding($this->_worksheets[$i]->name, "UTF-16LE", $this->_input_encoding);
+            else
+                $name = $this->_worksheets[$i]->name;
+            $offset += $boundsheet_length + strlen($name);
         }
         $offset += $EOF;
 
@@ -940,16 +954,26 @@
         } else {
             $length = 0x07 + strlen($sheetname); // Number of bytes to follow
         }
-
         $grbit     = 0x0000;                    // Visibility and sheet type
-        $cch       = strlen($sheetname);        // Length of sheet name
-
-        $header    = pack("vv",  $record, $length);
         if ($this->_BIFF_version == 0x0600) {
-            $data      = pack("Vvv", $offset, $grbit, $cch);
+            if ($this->_input_encoding != '') {
+                if ($this->_input_encoding != 'UTF16-LE')
+                    $sheetname = mb_convert_encoding($sheetname, "UTF-16LE", $this->_input_encoding);
+                $cch       = mb_strlen($sheetname, "UTF-16LE");
+                $encoding  = 1;
+                $data      = pack("VvCC", $offset, $grbit, $cch, $encoding);
+            } else {
+                $cch       = strlen($sheetname);
+                $data      = pack("Vvv", $offset, $grbit, $cch);
+            }
+            $length    = 0x08 + strlen($sheetname); // Number of bytes to follow
         } else {
+            $length = 0x07 + strlen($sheetname); // Number of bytes to follow
+            $cch       = strlen($sheetname);        // Length of sheet name
             $data      = pack("VvC", $offset, $grbit, $cch);
         }
+        
+        $header    = pack("vv",  $record, $length);
         $this->_append($header.$data.$sheetname);
     }
 
@@ -1020,16 +1044,22 @@
     function _storeNumFormat($format, $ifmt)
     {
         $record    = 0x041E;                      // Record identifier
-
+        
         if ($this->_BIFF_version == 0x0600) {
+            if ($this->_input_encoding != '') {
+                if ($this->_input_encoding != 'UTF16-LE')
+                    $format    = mb_convert_encoding($format, "UTF-16LE", $this->_input_encoding);
+                $cch       = mb_strlen($format, "UTF-16LE");
+            }
+            else
+                $cch       = strlen($format);             // Length of format string
             $length    = 5 + strlen($format);      // Number of bytes to follow
-            $encoding = 0x0;
+            $encoding = 0x1;
         } elseif ($this->_BIFF_version == 0x0500) {
             $length    = 3 + strlen($format);      // Number of bytes to follow
+            $cch       = strlen($format);             // Length of format string
         }
-
-        $cch       = strlen($format);             // Length of format string
-
+        
         $header    = pack("vv", $record, $length);
         if ($this->_BIFF_version == 0x0600) {
             $data      = pack("vvC", $ifmt, $cch, $encoding);
@@ -1038,7 +1068,7 @@
         }
         $this->_append($header . $data . $format);
     }
-
+    
     /**
     * Write DATEMODE record to indicate the date system in use (1904 or 1900).
     *
diff -Nur Spreadsheet_Excel_Writer-0.9.1.orig/Writer/Worksheet.php Spreadsheet_Excel_Writer-0.9.1/Writer/Worksheet.php
--- Spreadsheet_Excel_Writer-0.9.1.orig/Writer/Worksheet.php	2006-09-27 02:17:38.000000000 +0800
+++ Spreadsheet_Excel_Writer-0.9.1/Writer/Worksheet.php	2008-06-21 14:46:44.177486354 +0800
@@ -1230,7 +1230,7 @@
     */
     function _XF(&$format)
     {
-        if ($format) {
+        if (is_object($format)) {
             return($format->getXfIndex());
         } else {
             return(0x0F);
@@ -1514,10 +1514,10 @@
     */
     function setInputEncoding($encoding)
     {
-         if ($encoding != 'UTF-16LE' && !function_exists('iconv')) {
-             $this->raiseError("Using an input encoding other than UTF-16LE requires PHP support for iconv");
+         if (!function_exists('mb_convert_encoding') || !function_exists('mb_strlen')) {
+             $this->raiseError("Using an input encoding requires PHP support for mb_convert_encoding() and mb_strlen()");
          }
-         $this->_input_encoding = $encoding;
+         $this->_input_encoding = strtoupper($encoding);
     }
 
     /**
@@ -1537,15 +1537,11 @@
     */
     function writeStringBIFF8($row, $col, $str, $format = null)
     {
-        if ($this->_input_encoding == 'UTF-16LE')
-        {
-            $strlen = function_exists('mb_strlen') ? mb_strlen($str, 'UTF-16LE') : (strlen($str) / 2);
-            $encoding  = 0x1;
-        }
-        elseif ($this->_input_encoding != '')
+        if ($this->_input_encoding != '')
         {
-            $str = iconv($this->_input_encoding, 'UTF-16LE', $str);
-            $strlen = function_exists('mb_strlen') ? mb_strlen($str, 'UTF-16LE') : (strlen($str) / 2);
+            if ($this->_input_encoding != 'UTF-16LE')
+                $str = mb_convert_encoding($str, 'UTF-16LE', $this->_input_encoding);
+            $strlen = mb_strlen($str, 'UTF-16LE');
             $encoding  = 0x1;
         }
         else
@@ -1789,6 +1785,40 @@
     }
 
     /**
+     * Write a formula to the specified row and column (zero indexed).
+     * For the packed binary string representation of the formula.
+     *
+     * Returns  0 : normal termination
+     *         -2 : row or column out of range
+     *
+     * @access public
+     * @param integer $row     Zero indexed row
+     * @param integer $col     Zero indexed column
+     * @param binary  $formula The formula binary string
+     * @param mixed   $format  The optional XF format
+     * @return integer
+     */
+    function writeFormulaBin($row, $col, $formula, $format = 0)
+    {
+        $record    = 0x0006;     // Record identifier
+        $xf        = $this->_XF($format); // The cell format
+        $num       = 0x00;                // Current value of formula
+        $grbit     = 0x03;                // Option flags
+        $unknown   = 0x0000;              // Must be zero
+        
+        // Check that row and col are valid and store max and min values
+        if ($this->_checkRowCol($row, $col) == false) return -2;
+        
+        $formlen    = strlen($formula);    // Length of the binary string
+        $length     = 0x16 + $formlen;     // Length of the record data
+        $header    = pack("vv",      $record, $length);
+        $data      = pack("vvvdvVv", $row, $col, $xf, $num,
+                          $grbit, $unknown, $formlen);
+        $this->_append($header . $data . $formula);
+        return 0;
+    }
+
+    /**
     * Write a hyperlink.
     * This is comprised of two elements: the visible label and
     * the invisible link. The visible label is the same as the link unless an
@@ -2606,8 +2636,13 @@
         $str      = $this->_header;       // header string
         $cch      = strlen($str);         // Length of header string
         if ($this->_BIFF_version == 0x0600) {
-            $encoding = 0x0;                  // TODO: Unicode support
-            $length   = 3 + $cch;             // Bytes to follow
+            if ($this->_input_encoding != 'UTF-16LE') 
+                $str = mb_convert_encoding($str, "UTF-16LE", $this->_input_encoding);
+            $cch = mb_strlen($str, "UTF-16LE");
+            $encoding = 1;
+            $length   = 3 + $cch * 2;             // Bytes to follow
+            //$encoding = 0x0;                  // TODO: Unicode support
+            //$length   = 3 + $cch;             // Bytes to follow
         } else {
             $length  = 1 + $cch;             // Bytes to follow
         }
@@ -2634,8 +2669,11 @@
         $str      = $this->_footer;       // Footer string
         $cch      = strlen($str);         // Length of footer string
         if ($this->_BIFF_version == 0x0600) {
-            $encoding = 0x0;                  // TODO: Unicode support
-            $length   = 3 + $cch;             // Bytes to follow
+            if ($this->_input_encoding != 'UTF-16LE')
+                $str = mb_convert_encoding($str, "UTF-16LE", $this->_input_encoding);
+            $cch = mb_strlen($str, "UTF-16LE");
+            $encoding = 1;
+            $length   = 3 + $cch * 2;             // Bytes to follow
         } else {
             $length  = 1 + $cch;
         }
