Forum und email
unicode_encode

unicode_encode

(PHP 5 CVS only)

unicode_encode -- Set encoding of a unicode string

Popis

string unicode_encode ( unicode input, string encoding, int flags )

Varování

Tato funkce ještě není zdokumentována, k dispozici je pouze seznam argumentů.

Takes a unicode string and converts it to a string in the specified encoding.

Seznam parametrů

input

The unicode string that will be encoded.

encoding

The new encoding for input.

flags

Flags

Návratové hodnoty

A string on success, or FALSE on failure.

Errors/Exceptions

Emits a E_WARNING level error if a converter cannot be created for the desired encoding.

Příklady

Příklad 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);
?>

Výše uvedený příklad vypíše něco jako:

Unicode semantics: 1
The string itself: &#336;&#377;
The length of the string: 2

Viz také

unicode_symantics()