Michael Wallner wrote:
> it seems that the function doesn't work with higher
> values like "\u20AC" which is the EUR symbol :-(
Hi Mike,
it's most probably the font you're using that does not have support for the
EUR symbol. I tested the following on my box, and it displays fine:
<?php
function unichr($hex)
{
$utf = '';
$hex = hexdec((substr($hex, 0,2) === '\\u') ? substr($hex, 2) :
$hex);
if ($hex < 128) {
$utf = chr($hex);
} elseif ($hex < 2048) {
$utf .= chr(192 + (($hex - ($hex % 64)) / 64));
$utf .= chr(128 + ($hex % 64));
} else {
$utf .= chr(224 + (($hex - ($hex % 4096)) / 4096));
$utf .= chr(128 + ((($hex % 4096) - ($hex % 64)) / 64));
$utf .= chr(128 + ($hex % 64));
}
return $utf;
}
header('Content-Type: text/plain; charset: utf-8');
print unichr('\\u20AC');
?>
Most fonts (used to) only have the iso 8859-1 characters, and the EUR symbol
is only added in iso 8859-15.
Hope that solves your problem...
Keep up the good work :)
regards,
asgeir
--
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php