Cleaning bad characters from var

From: Date: Fri, 21 Jul 2006 19:42:51 +0000
Subject: Cleaning bad characters from var
Groups: php.general 
Request: Send a blank email to php-general+get-239690@lists.php.net to get a copy of this message
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

« previous php.general (#239690) next »