diff --git a/kernel/private/classes/clusterfilehandlers/dfsbackends/mysql.php b/kernel/private/classes/clusterfilehandlers/dfsbackends/mysql.php
index d7eb373e79ecdb1c3fe13f84d145692f6e71f493..4cdf05b6dd1f3dcbae6e32c0172ed2323d6b20d4 100644
--- a/kernel/private/classes/clusterfilehandlers/dfsbackends/mysql.php
+++ b/kernel/private/classes/clusterfilehandlers/dfsbackends/mysql.php
@@ -60,8 +60,22 @@ class eZDFSFileHandlerMySQLBackend
      * @throw eZClusterHandlerDBNoConnectionException
      * @throw eZClusterHandlerDBNoDatabaseException
      **/
-    public function _connect()
+    public function _connect( $charset = null )
     {
+        self::$CharsetMapping = array( 'iso-8859-1' => 'latin1',
+                                       'iso-8859-2' => 'latin2',
+                                       'iso-8859-8' => 'hebrew',
+                                       'iso-8859-7' => 'greek',
+                                       'iso-8859-9' => 'latin5',
+                                       'iso-8859-13' => 'latin7',
+                                       'windows-1250' => 'cp1250',
+                                       'windows-1251' => 'cp1251',
+                                       'windows-1256' => 'cp1256',
+                                       'windows-1257' => 'cp1257',
+                                       'utf-8' => 'utf8',
+                                       'koi8-r' => 'koi8r',
+                                       'koi8-u' => 'koi8u' );
+
         // DB Connection setup
         // This part is not actually required since _connect will only be called
         // once, but it is useful to run the unit tests. So be it.
@@ -112,6 +126,34 @@ class eZDFSFileHandlerMySQLBackend
         {
             $this->dfsbackend = new eZDFSFileHandlerDFSBackend();
         }
+
+        if ( $charset !== false && $charset !== null )
+        {
+            $charset = eZCharsetInfo::realCharsetCode( $charset );
+            // Convert charset names into something MySQL will understand
+            if ( isset( self::$CharsetMapping[ $charset ] ) )
+                $charset = self::$CharsetMapping[ $charset ];
+        }
+        else
+        {
+            $charset = $siteINI->variable( 'DatabaseSettings', 'Charset' );
+            if ( trim( $charset ) == '' )
+            {
+                $charset = eZTextCodec::internalCharset();
+            }
+        }
+
+        if ( $this->db && $charset && $this->isCharsetSupported( $charset ) )
+        {
+            if ( isset( self::$CharsetMapping[ $charset ] ) )
+                $charset = self::$CharsetMapping[ $charset ];
+            $query = "SET NAMES '" . $charset . "'";
+            $status = mysql_query( $query, $this->db );
+            if ( !$status )
+            {
+                $this->_fail( "Failed to set Database charset to $charset." );
+            }
+        }
     }
 
     /**
@@ -1675,6 +1717,34 @@ class eZDFSFileHandlerMySQLBackend
         return $filePathList;
     }
 
+
+    protected function databaseServerVersion()
+    {
+        $versionInfo = mysql_get_server_info();
+
+        $versionArray = explode( '.', $versionInfo );
+
+        return array( 'string' => $versionInfo,
+                      'values' => $versionArray );
+    }
+
+    protected function isCharsetSupported( $charset )
+    {
+        if ( $charset == 'utf-8' )
+        {
+            $versionInfo = $this->databaseServerVersion();
+
+            // We require MySQL 4.1.1 to use the new character set functionality,
+            // MySQL 4.1.0 does not have a full implementation of this, see:
+            // http://dev.mysql.com/doc/mysql/en/Charset.html
+            return ( version_compare( $versionInfo['string'], '4.1.1' ) >= 0 );
+        }
+        else
+        {
+            return true;
+        }
+    }
+
     /**
      * DB connexion handle
      * @var handle
@@ -1712,6 +1782,8 @@ class eZDFSFileHandlerMySQLBackend
      * @var eZDFSFileHandlerDFSBackend
      **/
     protected $dfsbackend = null;
+
+    protected static $CharsetMapping = null;
 }
 
 ?>
