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: ŐŹ
The length of the string: 2