unicode_encode

(PHP 5 CVS only)

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

Описание

string unicode_encode ( unicode input, string encoding )

Внимание

К настоящему времени эта функция еще не была документирована; для ознакомления доступен только список аргументов.

Список параметров

input

Its description

encoding

Its description

Возвращаемые значения

What the function returns, first on success, then on failure.

Примеры

Пример 1. A unicode_encode() example

Any text that describes the purpose of t

<?php
if ($anexample === true) {
   echo
'Use the PEAR Coding Standards';
}
?>

Результат выполнения данного примера:

Use the PEAR Coding Standards

Смотрите также

unicode_decode()



unicode_encode
Hugo Dworak (post at o2 dot pl)
23-Nov-2005 06:54
As for an example of the usage of the function 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, 'The string itself: ';
 
printf ($encoded . PHP_EOL, '%s');
  echo
'The length of the string: ', strlen ($encoded);
?>

The above example will output (please note that there will be characters instead of entities in the output):

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

<i18n_loc_set_defaultURLs>
 Last updated: Tue, 15 Nov 2005