(PHP 5 >= 5.2.3)
mysql_set_charset — Sets the client character set
Esta extensão tornou-se defasada a partir do PHP 5.5.0 e foi removida no PHP 7.0.0. Em vez disso, as extensões MySQLi ou PDO_MySQL devem ser usadas. Veja também o guia MySQL: escolhendo uma API. Alternativas a esta função incluem:
charset
to the connection string, such as charset=utf8
Sets the default character set for the current connection.
charset
A valid character set name.
link_identifier
A conexão MySQL. Se o identificador da conexão não for especificado, a última conexão aberta por mysql_connect() será usada. Se não houver uma conexão anterior, haverá uma tentativa de criar uma como se mysql_connect() tivesse sido chamada sem argumentos. Se nenhuma conexão for encontrada ou estabelecida, um erro de nível E_WARNING
será gerado.
Nota:
This function requires MySQL 5.0.7 or later.
Nota:
This is the preferred way to change the charset. Using mysql_query() to set it (such as
SET NAMES utf8
) is not recommended. See the MySQL character set concepts section for more information.