On Tue, 5 Dec 2006 12:37:48 -0000, "Chris Dean" wrote:
> I was just wondering if anyone knows why php's utf8_encode
> function converts the £ symbol into £
Yes. The '£' character is a two-octet sequence
in UTF-8. The problem is that you are viewing it
as if it were encoded in ISO-8859-1 (or similar).
These are the octet sequences for the characters
involved:
Character ISO-8859-1 UTF-8
----------- ---------- -------
£ (pound) <a3> <c2 a3>
 (A-circ.) <c2> <c3 82>
In other words, you are seeing the two characters
<c2><a3> instead of the one character <c2 a3>.
The fact that <a3> appears in both encodings is
nothing more than an interesting coincidence.
Example (right):
<?php
header ('Content-Type: text/plain; charset=utf-8');
echo utf8_encode ("\xa3");
?>
Example (wrong):
<?php
header ('Content-Type: text/plain; charset=iso-8859-1');
echo utf8_encode ("\xa3");
?>
--nfe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php