Cleaning bad characters from var

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear All,

I'm trying to set up an XML feed form our news articles. My XML is validating. 
The issue  is some of the articles have a weird encoding.

It seems to be single quotes. For example:
the world<92>s largest live event producer

Notice the <92>.

I already have this to clean vars but its not doing the trick:

                // clean bad chars for valid XML
                //$patterns[0] = '/=/';
                $patterns[1] = '/</';
                $patterns[2] = '/>/';
                $patterns[3] = '/\'/';
                $patterns[4] = '/\"/';
                $patterns[5] = '/&/';

                //$replacements[0] = '/&eq/';
                $replacements[1] = '/&lt/';
                $replacements[2] = '/&gt/';
                $replacements[3] = '/&apos;/';
                $replacements[4] = '/&quot;/';
                $replacements[5] = '/&amp;/';





                // chars to replace
                $badwordchars=array(
                "\xe2\x80\x98", // left single quote
                "\xe2\x80\x99", // right single quote
                "\xe2\x80\x9c", // left double quote
                "\xe2\x80\x9d", // right double quote
                "\xe2\x80\x94", // em dash
                "\xe2\x80\xa6" // elipses
                );

                $fixedwordchars=array(
                "&#8216;",
                "&#8217;",
                '&#8220;',
                '&#8221;',
                '&mdash;',
                '&#8230;'
                );

An thoughts would be very helpful.

Thank You,

-- 
Paul Nowosielski
Webmaster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux