Change database encoding in codeigniter

Does

mysql_query('SET NAMES `utf8`;', $link);

is the same that

$db['default']['char_set'] = 'utf8';

OR

$db['default']['dbcollat'] = 'utf8_general_ci';

in “application\config\database.php” on Codeigniter? If not, how can I do it in Codeigniter?

CodeIgniter has a config file that lets you store your database connection values (username, password, database name, etc.). The config file is located at application/config/database.php. You can also set database connection values for specific environments by placing database.php it the respective environment config folder.

More on this page: http://codeigniter.com/user_guide/database/configuration.html

Place a database.php in your application/config folder and edit the file to suit your needs.