<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -46,7 +46,6 @@ require_once 'phing/tasks/ext/HeaderTask.php';
  * @author  Mehdi Kabab &lt;pioupioum|at|gmail|dot|com&gt;
  * @version 1.0
  * @package phing.tasks.ext
- * @todo    Manage encoding
  */
 class HeaderPhpTask extends HeaderTask
 {
@@ -66,7 +65,7 @@ class HeaderPhpTask extends HeaderTask
         
         while (list($k, $v) = each($content))
         {
-            $pos = strpos($v, '&lt;?php');
+            $pos = mb_strpos($v, '&lt;?php', $this-&gt;getToEncoding());
             
             if (false !== $pos)
             {
@@ -94,7 +93,9 @@ class HeaderPhpTask extends HeaderTask
     **/
     protected function _concat($header, $content)
     {
-        return '&lt;?php' . $this-&gt;getEol() . $header . $this-&gt;getEol() . $content;
+        $phpTag  = mb_convert_encoding('&lt;?php' . $this-&gt;getEol(), $this-&gt;getToEncoding(), 'UTF-8');
+        
+        return $phpTag . parent::_concat($header, $content);
     }
 
 }</diff>
      <filename>src/HeaderPhpTask.php</filename>
    </modified>
    <modified>
      <diff>@@ -43,7 +43,6 @@ require_once 'phing/system/io/PhingFile.php';
  * @author  Mehdi Kabab &lt;pioupioum|at|gmail|dot|com&gt;
  * @version 1.0
  * @package phing.tasks.ext
- * @todo    Manage encoding
  */
 class HeaderTask extends Task
 {
@@ -72,6 +71,20 @@ class HeaderTask extends Task
     protected $_verbosity = Project::MSG_VERBOSE;
 
     /**
+     * Encoding of header file.
+     *
+     * @var string
+     **/
+    protected $_encoding = 'UTF-8';
+
+    /**
+     * Encoding of input file(s).
+     *
+     * @var string
+     **/
+    protected $_destEncoding = 'UTF-8';
+
+    /**
      * What to do when it goes pear-shaped.
      * 
      * @var boolean
@@ -137,6 +150,54 @@ class HeaderTask extends Task
     }
 
     /**
+     * Specifies the encoding for the header file.
+     * 
+     * @param  string $encode The name of the charset used to encode
+     * @return void
+     * @access public
+     **/
+    public function setEncoding($encoding)
+    {
+        $this-&gt;_encoding = (string) $encoding;
+    }
+
+    /**
+     * Get the encoding of the header file.
+     * 
+     * @param  void
+     * @return string
+     * @access public
+     **/
+    public function getEncoding()
+    {
+        return $this-&gt;_encoding;
+    }
+
+    /**
+     * Specifies the encoding for the input file(s).
+     * 
+     * @param  string $encode The name of the charset used to encode
+     * @return void
+     * @access public
+     **/
+    public function setToEncoding($encoding)
+    {
+        $this-&gt;_destEncoding = (string) $encoding;
+    }
+
+    /**
+     * Get the encoding of the input file(s).
+     * 
+     * @param  void
+     * @return string
+     * @access public
+     **/
+    public function getToEncoding()
+    {
+        return $this-&gt;_destEncoding;
+    }
+
+    /**
      * Set whether to fail when errors are encountered.
      * 
      * Stop the build process if true. If false, note errors to the output 
@@ -446,6 +507,8 @@ class HeaderTask extends Task
             }
         }
         
+        $header = mb_convert_encoding($header, $this-&gt;_destEncoding, $this-&gt;_encoding);
+        
         return $header . $this-&gt;getEol() . $content;
     }
 </diff>
      <filename>src/HeaderTask.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>425911ea6cb65394d7207ad2a098adcf0d9f10a5</id>
    </parent>
  </parents>
  <author>
    <name>Mehdi Kabab</name>
    <email>pioupioum@gmail.com</email>
  </author>
  <url>http://github.com/piouPiouM/phing-header/commit/90f52688a4d5208afbdc018b4ad2841625e8c768</url>
  <id>90f52688a4d5208afbdc018b4ad2841625e8c768</id>
  <committed-date>2008-09-06T04:14:36-07:00</committed-date>
  <authored-date>2008-09-06T04:14:36-07:00</authored-date>
  <message>Added support of encoding.

* Added support of encoding attribute (default: UTF-8)
* Added support of toencoding attribute (default: UTF-8)</message>
  <tree>4923ea2f01b4c1cf745ca40127b40434b713ac5e</tree>
  <committer>
    <name>Mehdi Kabab</name>
    <email>pioupioum@gmail.com</email>
  </committer>
</commit>
