View Single Post
Old 07-02-2010, 02:25 PM   #1 (permalink)
Tim Dobson
The Contributor
 
Tim Dobson's Avatar
 
Join Date: Feb 2010
Posts: 69
Thanks: 16
Tim Dobson is on a distinguished road
Default stupid encodings -.-

Ok.. so i have been trying to convert Encodings and failed. Yes i know, but every time i try it well.. it fails. Clearly i am doing something wrong so i need a lil help :P.

PHP Code:
<?php
                    
$myFile 
"includes/docs/quotepend.txt";
$fh fopen($myFile'r');
$theData fread($fhfilesize($myFile));
fclose($fh);
function 
fixEncoding($theData)
{
  
$cur_encoding mb_detect_encoding($theData) ;
  if(
$cur_encoding == "UTF-8" && mb_check_encoding($theData,"UTF-8"))
    return 
$theData;
  else
    return 
utf8_encode($theData);
// fixEncoding
echo '<div class="HASHLISTPHP">' $theData '</div>';

That is what i have in my coding. Its simple its just a page reading a text file... but the encoding is still coming out all spoony E.G. -Ŧķ-κıℓℓεя turns in to -Ŧķ-κı????εя when read on the page lol.

That is a convert script i got from an example on a site so i dont know if thats correct or if its just the script is in the wrong place.


Thanks
Tim Dobson is offline  
Reply With Quote