Help me with passing clean URL with special characters

I’m having issues cleaning out special characters from my script
currently I’m using the toAscii function(below) and it is removing all special characters such as %,$,# and so on, and it does work

this is how a cleaned URL looks like

http://www.site.cxx/latest/this-is-test.html

but when I click on the actual link it doesn’t work just sends me back to the home page. Any ideas

thanks

here is the code that retrieves from DB

<?php	while($row=mysql_fetch_assoc($getAll)){	?> 
    
  <div class="news">
    <span class="antetitulo">text"</span>
    <br />
    <h2 class="title h2">
      <a href="http://www.site.cxx/<?=str_ireplace(" ","-",html_entity_decode($row['genre']));?>/<?php echo toAscii($row['name']); ?>.html"><?=html_entity_decode($row['name']);?></a> 
    </h2>
	 <img src="http://www.site.cxx/images/<?=$row['image'];?>" width="350"   height="103" />

    <div class="text">

   <?php echo substr(strip_tags($row['description']),0,130)  ?>.</span></div>
    <br class="c" />
  </div>

  <?php	$i++;	}?>
  

  

I’m also trying to “clean” characters using this function

<?php
setlocale(LC_ALL, 'en_US.UTF8');
function toAscii($str, $replace=array(), $delimiter='-') {
	if( !empty($replace) ) {
		$str = str_replace((array)$replace, ' ', $str);
	}

	$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
	$clean = preg_replace("/[^a-zA-Z0-9\\/_|+ -]/", '', $clean);
	$clean = strtolower(trim($clean, '-'));
	$clean = preg_replace("/[\\/_|+ -]+/", $delimiter, $clean);

	return $clean;
}
?>

this is my .htaccess

RewriteRule ^([^/]*)/([^/]*)\\.html$ /news.php?cat=$1&news=$2 [L]

Sinz,

It’s too late this evening to answer this so please refer to the tutorial linked in my signature as it will lead you through the development of the solution.

Regards,

DK