unicode_encode
(No version information available, might be only in CVS)
unicode_encode — Convert a unicode string in any encoding
Leírás
Takes a unicode string and converts it to a string in the specified encoding .
Paraméterek
- input
-
The unicode string that is converted.
- encoding
-
The new encoding for input .
- errmode
-
Conversion error mode. This parameter determines the action to take when the converter cannot convert a character. For a list of available modes, refer to unicode_set_error_mode(). If the parameter is not set, the global error mode is used.
Visszatérési értékek
A string on success, or FALSE on failure.
Hibák/Kivételek
Emits a E_WARNING level error if a converter cannot be created for the desired encoding .
Példák
Example#1 A unicode_encode() example
Note: The characters will be seen instead of entities in the output.
<?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);
?>
A fenti példa valami ilyesmi kimenetet ad:
Unicode semantics: 1 The string itself: ŐŹ The length of the string: 2
Megjegyzések
Ez a függvény KÍSÉRLETI JELLEGGEL MŰKÖDIK. A függvény működése, neve, bármi amit a függévénnyel kapcsolatban dokumentáltunk megváltozhat egy későbbi PHP kiadásban minden figyelmeztetés nélkül. Ezt a függvényt csak a saját felelősségedre használd!