Forum Moderators: coopster

Message Too Old, No Replies

Special Character in php

Special Character in php

         

photocroatia

7:37 am on Nov 14, 2004 (gmt 0)

10+ Year Member



I have one more php question which has me totally confused, I have tried everything, I have come to the conclusion that the script works if there are no special characters

The script has a variable $Place1 , I set the destination I want and it goes to a web page and rips the weather from that page (I have received permission to do this)

This script works if the Place doesn't have a special charcter.

This is the problem line

$Place1 = "Šibenik";

Is there anything I need to do to enable special characters?

Thank you very much.

I have the entire script below:

<?
function printWeatherConditions(){
$Place1 = "Šibenik";
$CacheDir = "webcell_cache";
$File1 = "http://www.#*$!.xxx.xx/vrijeme/cro.html";

include("WebCell.php");

$wcObject = new WebCell($File1);
//$wcObject->EnableCache($CacheDir, 3600);
$i=0;
$ack = false;

while($wcObject->GetCell(0,$i,1)!=$Place1 && $wcObject->NumberOfRows(0)>=$i) $i++;

if($i<=$wcObject->NumberOfRows(0)){
$ack = true;
//print "Place: ". $wcObject->GetCell(0,$i,1) . "<BR>";
$airTemp = $wcObject->GetCell(0,$i,4). " &ordm;C";
}

if($ack){
echo "<tr>";
echo "<p><b><font face=\"Arial\" color=\"white\" size=\"1\">$airTemp</font></b></p>";
}

}
printWeatherConditions();
?>

Timotheos

6:04 am on Nov 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think you're on the right track. I believe the php default is ISO-8859-1 whereas the page you're scraping is most likely different. You might need to use something like utf8_endode [us2.php.net] or iconv [us2.php.net] to compare apples with apples.