Re: Downloading utf-8 encoded files

From: Date: Tue, 26 Dec 2006 18:54:45 +0000
Subject: Re: Downloading utf-8 encoded files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-246228@lists.php.net to get a copy of this message
Hi Try this: <?php ... $contents=file_get_contents($link); file_put_contents("kml/$.kml",$contents) ?> There shouldn't be a character encoding problem with this two lines. Don't forget the mime type: http://earth.google.com/support/bin/answer.py?answer=25094&topic=1139 bernhard Am Dienstag, den 26.12.2006, 17:22 +0500 schrieb Fahad Pervaiz: > I want to download UTF-8 encoded kml files from a website. I have written a > script that automatically downloads KML file. Problem is that some of the > utf-8 charc are distrubed after saving file on windows. below is the script. > > > . > . > . > > $handle = fopen($link, "rb"); > > $handle2= fopen("kml/$i.kml","w"); > > $contents = ''; > while (!feof($handle)) { > $contents = fread($handle, 8192); > fwrite($handle2, $contents); > } > fclose($handle); > fclose($handle2); > . > . > . > . > > Also, there is another problem.Downloading file using the above script, > downloads incomplete file, means some of the information is skipped and file > size is also small. > > Help would be appriciated >

« previous php.general (#246228) next »