Hi,

Presence of Hyphen character with Whitespcaes around is making my XML file -not well formed.I get XML not displayed in IE and FF.
if i have " bandwidth - 1.5mpbs" in my data.

I tried to strip the Whitespace using
- str_replace(" - ","-",$parameter)
- also str_replace with <nobr><nobr>
str_replace(" - ","<nobr>-<nobr>",$parameter)

when i echo the changed parameters,it shows the whitespaces around hyphen removed but when i generate xml, again its same and some weird -nonprintable character replaces '-' hyphen.
Firefox shows '?' kind and Textpad shows 'thick solid bar'

Anywhere else in data , if no Whitespace around hyphen works very fine.

So i guess WS is root-cause.
Anyway to strip Ws around hypen.???

    It shouldn't. Whitespace - hyphen - whitespace is perfectly well-formed character data (but <nobr> is not). There must be something wrong with how you're generating the XML.

      Where did the xml come from? I have found that hyphens created in MS word are not regular ascii hyphens and can cause issues like you are having.

      I guess if you have no control over the xml received (if via remotely) you need to find the hex (or similar) value by using some hexeditor and use str_replace on that exact value.

        doublehops wrote:

        I have found that hyphens created in MS word are not regular ascii hyphens and can cause issues like you are having.

        That could do it: en-dashes (&#8211;) and em-dashes (&#8212;) aren't hyphens (-), and aren't ASCII; for example, &#8211; and &#8212; aren't legitimate characters in UTF-8 unless they're encoded as &#226;&#8364;&#8220; and &#226;&#8364;&#8221;.

        So, are they hyphens?

          Write a Reply...