<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.mysql.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.mysql-set-charset.php',
    1 => 'mysql_set_charset',
    2 => 'クライアントの文字セットを設定する',
  ),
  'up' => 
  array (
    0 => 'ref.mysql.php',
    1 => 'MySQL 関数',
  ),
  'prev' => 
  array (
    0 => 'function.mysql-select-db.php',
    1 => 'mysql_select_db',
  ),
  'next' => 
  array (
    0 => 'function.mysql-stat.php',
    1 => 'mysql_stat',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/mysql/functions/mysql-set-charset.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mysql-set-charset" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mysql_set_charset</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.3)</p><p class="refpurpose"><span class="refname">mysql_set_charset</span> &mdash; <span class="dc-title">クライアントの文字セットを設定する</span></p>

 </div>

 <div id="function.mysql-set-charset-refsynopsisdiv">
  <div class="warning"><strong class="warning">警告</strong>
   <p class="para">
この拡張モジュールは PHP 5.5.0 で非推奨になり、PHP 7.0.0 で削除されました。
<a href="book.mysqli.php" class="link">MySQLi</a> あるいは
<a href="ref.pdo-mysql.php" class="link">PDO_MySQL</a> を使うべきです。詳細な情報は
<a href="mysqlinfo.api.choosing.php" class="link">MySQL: API の選択</a> を参照ください。
この関数の代替として、これらが使えます。</p>
   <ul class="simplelist">
    <li><span class="function"><a href="mysqli.set-charset.php" class="function">mysqli_set_charset()</a></span></li>
    <li>PDO: 接続文字列に <code class="literal">charset</code> を追加して <code class="literal">charset=utf8</code> などとする</li>
   </ul>
  </div>
 </div>

 <div class="refsect1 description" id="refsect1-function.mysql-set-charset-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mysql_set_charset</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$charset</code></span>, <span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$link_identifier</code><span class="initializer"> = NULL</span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="simpara">
   現在の接続における、デフォルトの文字セットを設定します。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mysql-set-charset-parameters">
  <h3 class="title">パラメータ</h3>
  <dl>
   
    <dt><code class="parameter">charset</code></dt>
    <dd>
     <span class="simpara">
      有効な文字セット名。
     </span>
    </dd>
   
   <dt><code class="parameter">link_identifier</code></dt><dd><p class="para">MySQL 接続。指定されない場合、<span class="function"><a href="function.mysql-connect.php" class="function">mysql_connect()</a></span> により直近にオープンされたリンクが指定されたと仮定されます。そのようなリンクがない場合、引数を指定せずに <span class="function"><a href="function.mysql-connect.php" class="function">mysql_connect()</a></span> がコールした時と同様にリンクを確立します。リンクが見付からない、または、確立できない場合、<strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> レベルのエラーが生成されます。</p></dd>
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mysql-set-charset-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="simpara">
   成功した場合に <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> を、失敗した場合に <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.mysql-set-charset-notes">
  <h3 class="title">注意</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <span class="simpara">
    この関数は、MySQL 5.0.7 以降でないと使用できません。
   </span>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <span class="simpara">
    文字セットを変更するにはこの方法を使うことを推奨します。
    <span class="function"><a href="function.mysql-query.php" class="function">mysql_query()</a></span> で (<code class="literal">SET NAMES utf8</code> などとして)
    設定する方法はお勧めできません。詳細は
    <a href="mysqlinfo.concepts.charset.php" class="link">MySQL の文字セットの概念</a>
    を参照ください。
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.mysql-set-charset-seealso">
  <h3 class="title">参考</h3>
  <ul class="simplelist">
   <li><a href="mysqlinfo.concepts.charset.php" class="link">MySQL での文字セットの設定</a></li>
   <li><a href="http://dev.mysql.com/doc/mysql/en/charset-charsets.html" class="link external">&raquo;&nbsp;MySQL がサポートする文字セットの一覧</a></li>
   <li><span class="function"><a href="function.mysql-client-encoding.php" class="function" rel="rdfs-seeAlso">mysql_client_encoding()</a> - 文字セット名を返す</span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>