Inserting unicode chars via yii1.1.17/pdo_dblib/freetds into SQL Server

I’m trying to investigate the interaction via Yii 1.1.17, pdo_dblib, freetds, and SQL Server via a simple instantiation of the model. After setting utf8 as the charset in my database connection string and freetds, I’ve created the following action:


public function actionTest()

    {


        $db= Variable::model()->findByPk(1);

        echo "Before update: " . $db->Name . "<br>";


        $db->Name = '最';

        $db->update();

        echo "After update: " . $db->Name . "<br>";


    }



From the /tmp/freetds.log, I note the following query sent to SQL Server:


UPDATE [dbo].[Variable] SET [Name]='最' WHERE [dbo].[Variable].[VariableID]=1

Which results in a Name record of “?” in SQL Server, due to the lack of an N prefix: e.g. N’最’

Is this the intended behavior between these mechanisms? If not, have I misconfigured something along the way and if so, 1) does the limitation lie in Yii, Freetds, or SQL Server? and 2) are there any workarounds to support integration with SQL Server and Unicode via the model in Yii 1.1.x?

Note that the following examples work just fine, e.g. :


$db->Name = 'Hallå'