php8.5
Home/ Manual/ mysql / functions/ mysql_client_encoding

mysql_client_encoding

PHP function Edit on GitHub ✎

(PHP 4 >= 4.3.0, PHP 5)

Returns the name of the character set

Note mysqli_character_set_name

Description

mysql_client_encoding(resource $link_identifier = NULL): string

Retrieves the character_set variable from MySQL.

Parameters

Return Values

Returns the default character set name for the current connection.

Examples

mysql_client_encoding() example

php
<?php
$link    = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$charset = mysql_client_encoding($link);

echo "The current character set is: $charset\n";
?>

The above example will output something similar to:

output
The current character set is: latin1

See Also

Source: reference/mysql/functions/mysql-client-encoding.xml · from the official PHP manual (php/doc-en)