jencinas69 0 Junior Poster in Training

Hello I have a csv file which I am parsing into XML with this code :

<?php
/**
* Converts a CSV file to a simple XML file
*
* @param string $file
* @param string $container
* @param string $rows
* @return string
*/

error_reporting(E_ALL ^ E_NOTICE);
ini_set("display_errors", true);


function csv2xml($file, $container = 'data', $rows = 'row')
{

  $r = "<{$container}>\n";
  $row = 0;
  $cols = 0;
  $titles = array();

  $handle = @fopen($file, 'r');
  if (!$handle) return $handle;

  while (($data = fgetcsv($handle, 1000, ',')) !== FALSE)
  {
    if ($row > 0) $r .= "\t<{$rows}";
    if (!$cols) $cols = count($data);
     for ($i = 0; ($i < $cols); $i++)
    {
      if ($row == 0)
      {
        $titles[$i] = trim($data[$i]); 
        continue;
      }
      
          if ($titles[$i] == "Description")
      {
        $r .= ">\n\t\t<description><![CDATA[";
        $r .= $data[$i];
        $r .= "]]></description>\n";
      } 
      elseif ($titles[$i] == "ID")
        $r .= " adID=\"{$data[$i]}\"";
      elseif ($titles[$i] == "Category")
        $r .= " catID=\"{$data[$i]}\"";
    }
    if ($row > 0) $r .= "\t</{$rows}>\n";
    $row++;
  }
  fclose($handle);
  $r .= "</{$container}>";

  return $r;


}



$xml = '<?xml version="1.0" encoding="ISO-8859-1"?> ';
$xml .= csv2xml('dtifeed.csv', 'export', 'ad');

$xmlfile = @fopen('dtifeed.xml', 'wb') or die('Could not open XML file for writing');

fwrite($xmlfile, $xml) or die('Could not write string to XML file');

fclose($xmlfile);

echo "Successfully wrote the XML file";






?>

this is a sample of the csv where I ran into problems, the parsing works fine, the problem i that when I upload the xml to the site I need it gives me a parsing error because of this character ¥

428977,515,,," ¥ Excellent 2nd income potential! ¥ Weekly Compensation! ¥ Deliveries are only once per week, every Saturday. ¥ Most independent carriers only spend 4 - 6 hours average per week delivering. ¥ Day-Time Delivery. ¥ You'll be delivering a great product-- SUPER SHOPPER! Must have valid AZ driver's license and provide proof of insurance. Call Daniel at 928-539-6910 or stop by and pick up an application at The Sun Subscription & Delivery department: 2055 S. Arizona Avenue, Yuma. $$ EARN EXTRA $$ INTERESTED IN EARNING EXTRA MONEY? DELIVERING YUMA COUNTY'S SUPER SHOPPER!

Is there any way I can get rid of thiis character while I am parsing the csv to xml ???