mysql_client_encoding

(PHP 4 >= 4.3.0, PHP 5)

mysql_client_encoding -- Returns the name of the character set

説明

string mysql_client_encoding ( [resource link_identifier] )

Retrieves the character_set variable from MySQL.

パラメータ

link_identifier

MySQL接続。 指定されない場合、mysql_connect() により直近にオープンされたリンクが 指定されたと仮定されます。そのようなリンクがない場合、引数を指定せずに mysql_connect() がコールした時と同様にリンクを確立します。 リンクが見付からない、または、確立できない場合、 E_WARNING レベルの警告が生成されます。

戻り値

Returns the default character set name for the current connection.

例 1. mysql_client_encoding() example

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

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

上の例の出力は例えば 以下のようになります:

The current character set is: latin1

以下も参照ください

mysql_real_escape_string()