Jump to content

Dealing with Special Characters and UTF?


CodeMama

Recommended Posts

I am having problems with a special character (the little degree symbol) I need to strip it out, or get it to show up...here is my script so far:

Or can I declare the UTF somewhere to handle special characters?

 

Script:

preg_match_all('/<p><font size="2" face="Arial, Helvetica, sans-serif">(.+)<br>(.+)<br>.+(\d+\/\d+\/\d+)\s(.+)<br>(.+)<br>.+Critical Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU', $url, $results);



for ($i=0; $i < count($results[0]); $i++) 
{
    $name = strtolower($results[1][$i]);

    $address = strtolower($results[2][$i]);
    
    $inDate = $results[3][$i];
    
    $inType = $results[4][$i];
    
    $notes = trim($results[5][$i]);
     
    $critical = trim($results[6][$i]);
    
    $cviolations = $results[7][$i];
    
    $noncritical = $results[8][$i];
    
    //trying to manipulate different field data
    
    $cleanViolations = str_replace('*', '', $cviolations);
    $ucName = ucwords($name);
    $ucAddress = ucwords($address);


       
        echo "$ucName <br>";
        echo "$ucAddress <br>";
        echo "$inDate <br>";
        echo "$inType <br>";
        echo "$notes <br>";
        echo "$critical <br>";
        echo "$cviolations <br><hr>";
        echo "$cleanViolations <br><hr>";
        echo "$noncritical <br>";
        

 

it's in the violations that sometimes the Fahrenheit symbol is used and it is outputing as a question mark....

help please

 

Link to comment
https://forums.phpfreaks.com/topic/164117-dealing-with-special-characters-and-utf/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.