unicode_encode
unicode_encode — unicode 文字列のエンコーディングを設定する
説明
string unicode_encode ( unicode input, string encoding, int flags )警告 |
この関数は、
現在のところ詳細な情報はありません。引数のリストのみが
記述されています。 |
unicode 文字列を受け取り、それを指定したエンコーディング encoding の文字列に変換します。
パラメータ
- input
-
エンコードする unicode 文字列。
- encoding
-
input の新しいエンコーディング。
- flags
-
フラグ。
返り値
成功した場合に文字列、失敗した場合に FALSE を返します。エラー / 例外
指定したエンコーディングの変換器が作成できない場合に E_WARNING レベルのエラーが発生します。例
例 2385. unicode_encode() の例注意: 出力は、エンティティではなく文字になります。
<?php
header ('Content-Type: text/plain; charset=ISO-8859-2');
$encoded = unicode_encode ('\u0150\u0179', 'ISO-8859-2');
echo 'Unicode semantics: ', ini_get ('unicode_semantics'), PHP_EOL;
echo 'The string itself:', $encoded, PHP_EOL;
echo 'The length of the string: ', strlen ($encoded);
?>
上の例の出力は、たとえば
以下のようになります。Unicode semantics: 1 The string itself: ŐŹ The length of the string: 2
参考
unicode_symantics() |
Weblioに収録されているすべての辞書からunicode_encodeを検索する場合は、下記のリンクをクリックしてください。

- unicode_encodeのページへのリンク