On Fri, 07 Nov 2003 14:16:53 +0100, Robert Zierhofer <ro*@starbugg.de> wrote:
it seems as if i can´t convert the euro and pound sign to their html
equivalents.
i tried
eregi_replace("€", "€", $haystack);
eregi_replace("£", "£", $haystack);
as well as
str_replace("€", "€", $haystack);
str_replace("£", "£", $haystack);
to the script:
the values are coming from a http form post.
i thought the the problem could be maybe some wacko encoding that is
done because of the form.
any ideas??
The main gotcha with the Euro is that it's a different code point under
different character sets.
iso-8859-1 doesn't have it at all - it was created before the Euro existed.
iso-8859-15 has it as chr(164), replacing the universal currency symbol that
was in that code point in iso-8859-1.
To make it worse, Windows codepage 1252 has it in chr(128).
In Unicode it's U+20AC (i.e. 20AC in hexadecimal; the actual representation
depends on the encoding, e.g. UTF-8).
Some charts of the character sets here:
http://en.wikipedia.org/wiki/ISO-8859-1 http://en.wikipedia.org/wiki/ISO_8859-15
So - check your input data to see whether it's using chr(164) or chr(128) - or
something else.
Then check your script to see whether the literal € you have there is encoded
with the same code point. If not - try using chr(164) or chr(128) as
appropriate.
The headers in your post indicate you posted using:
Content-Type: text/plain; charset=windows-1252; format=flowed
^^^^^^^^^^^^^^^^^^^^
So the Euro in your message must be chr(128); copying it into a hex editor
confirms that. I bet your data is encoded with an iso-8859 based character set,
so it's chr(164).
Not sure about the £ though since that doesn't differ between the commonly
used character sets; chr(163).
--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (
http://www.andyh.co.uk)
Space: disk usage analysis tool (
http://www.andyhsoftware.co.uk/space)