I've added a wiki entry to show how to do this http://www.phpactiverecord.org/projects/main/wiki/Configuration__Setup#encoding
Hi guys.
Your solution don't work for me.
I added a line in the Connection class __contruct
$this->connection->query("SET NAMES 'utf8';");
It's working fine now.
Thanks anyway
You're probably not using the most recent version then. You'll need the latest for it to work.
Tanks.
Hi'ya'all
i think that should add validation for mysql also;
active-records\lib\connection.php (line 203)
...
if($info->protocol=='mysql') {
$this->connection->query("SET NAMES 'utf8';");
$this->connection->query("SET CHARACTER SET utf8;");
}
Thank u very much
no problem - i have found another problems so i extend little
if($info->protocol=='mysql')
{
$this->connection->query("SET NAMES 'utf8'");
$this->connection->query("SET CHARACTER SET utf8");
$this->connection->query("SET character_set_connection=utf8");
$this->connection->query("SET character_set_client=utf8");
}
I don't work.Please help me !
view uf8 is ok !
But insert to database not work
Check your mysql what is the column charsets and also check if you sending to mysql as default utf-8
My database
CREATE TABLE `users` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`gid` int(11) DEFAULT NULL,
`username` text,
`password` text,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8
Can you give me your application for a test !
Thank you !
First, i think you should read http://www.phpactiverecord.org/projects/main/wiki/Conventions
uid = should be id
gid = group_id
users = people
2nd, ALTER TABLE `users` CHARACTER SET = utf8 , COLLATE = utf8_general_ci ;
not work
`username` text CHARACTER SET utf8,
`password` text CHARACTER SET utf8,
Code
$user = new Users;
$user->username="Cộng hòa xã hội chủ nghĩa việt nam";
$user->password='123456';
$user->save();
view database "C?ng h?a x? h?i ch? ngh?a vi?t nam"
Can You help me ? You can send me your test to email:
You can remote my desktop with teamviewer!
ID:868 417 770
Pass:6151
Thank you very much !
Thanh you !
I have done !
I update activerecord 1.0rc1
December 26, 2011
The wiki's entry by Kien La does not work to me.
Solution: Change '?' delimiter to ';'.
Example:
$config->set_connections(array( 'development' => 'mysql://user:pass@localhost/mydb;charset=utf8') );
Now, it works fine!
ref.: PHP ActiveRecord Version 1.0 - June 27, 2010
Sergio M C Figueiredo
http://blog.devdelver.com
(1-14/14)
Subject: set_encoding($charset)
Hi, great work.
How I set de charset to utf-8?