I am trying to use the CDbmessageSource with sql server. If I retrieve the translation outside of the framework, it looks like this: actualización. Using Yii::t it looks like this: actualizaci�n. The message and translation columns are ntext to accomodate for utf8. Notice I am converting the ntext coluns to text columns in the query otherwise I would get sql server error.
Non Yii code:
$mssql = new PDO(‘dblib:host=JUSSLCITWS02;dbname=dbname’,‘user’,‘pass’);
When I see correct in db interface and then incorrect in Yii page (or viceversa) I know that a query ‘SET NAMES utf8’ is needed in mysql.
I don’t know the equivalent for mysql, but I can advice a dirty solution (with whom I worked fine for 2 years).
You can try building a simple interface for instert your translations with an Yii interface. Like that there will always been the mismatch, but at least the translation will be correctly shown in your application and incorrectly in db.
That is not a solution, but allows you to move forward.
In our languages (I am italian) there are only a few not-ascii character, and so you can even don’t care of it (like I did for years).
But when you go working in russia… you have to learn how to work correctly with encoding
initSQLs does not seem to come with Yii 1.1 and returns: Property "CDbConnection.initSQLs" is not defined. (/home/yourownb/framework/base/CComponent.php:173) Is there a work around for this older version of Yii?
I am having an issue with German names such as Köln and cannot match them against DB records and I think initSQLs is what I need but is not supported by Yii 1.1
Hmm. charset should actually do that for you. But it’s only used for sqlite, despite the comment tells otherwhise.
* Initializes the open db connection.
* This method is invoked right after the db connection is established.
* The default implementation is to set the charset for MySQL and PostgreSQL database connections.
* @param PDO the PDO instance
protected function initConnection($pdo)
if($this->emulatePrepare && constant('PDO::ATTR_EMULATE_PREPARES'))
$pdo->exec('SET NAMES '.$pdo->quote($this->charset));
foreach($this->initSQLs as $sql)