|
Posted by Toby Inkster on 06/15/06 07:14
ReGenesis0 wrote:
> The POINt is, they choke on funny characters, even encoded funny
> characters. You need to use the unicode. (change ñ to ñ).
There is no such thing as ñ in generic XML. ñ is a purely
HTML concept. There are only five pre-defined entities which XML parsers
are expected to know:
&
<
>
"
'
If PHP understood ñ in generic XML it would be behaving
*incorrectly*. ñ is undefined. (I'm assuming here that you've not
written a DTD that defines what ñ means, which seems like a
reasonable assumption.)
> Does PHP have a function that will escape all funny characters in a
> string (encoded, unencoded, both, either...) to their unicode
> equivilants?
It seems you want some function that converts:
ñ => ñ
€ => €
You might be able to do this using html_entity_decode() to get everything
in its raw form (e.g. will convert € to €) and then use a regular
expression to convert things into numeric character references (e.g. €
to €). Such a regular expression can be found in soapergem at gmail
dot com's 10 May 2006 comment here:
http://uk2.php.net/manual/en/function.htmlentities.php
That said, you're better off correcting the root problem -- that ñ
is not correct XML.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
[Back to original message]
|