I have posted this on another forum to try and get help but was unsuccessful.
My text field reads a text file but the text file contains UTF-8 and when the text field reads it i get all jibberish text. E.G. -Ŧķ-κıℓℓεя comes out as -Ŧķ-κıℓℓεÑ
I did try something like the following.
But clearly that is wrong or something in there is wrongPHP Code:<?php
$myFile = "includes/docs/sdata.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($theData));
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 '<span id="sprytextfield1">
<label for="templateedit">Edit template script</label><br /><textarea name="templateedit" cols="90" rows="90" id="templateedit">' . $theData . '</textarea>
<span class="textfieldRequiredMsg">A value is required.</span></span></div>'
?>
I am newish to php so you have to bare with my n00bish code.
Help would be greatly appriciated![]()




Reply With Quote


Bookmarks