I don't really want to htmlentities it to put it in the txt file, I just want to write the £ sign. The odd thing is that no matter how I approach it I end up with an odd character before the £.
Taking a text file containing the offending character and presenting it to be edited I have obviously htmlentitised the whole text file and the £ sign shows up fine and is encoded as £
When I submit the form and just echo out the $_POST["textfield"] it displays as £ which is what I want to write to file.
but when I pass it to the function:
Code: Select all
function upload_text($directoryPath, $textFile, $text)
{
//echo "We're going to be obliterating ".$directoryPath."/".$textFile;
$fp = @fopen($directoryPath."/".$textFile,"w");
ftruncate($fp,0);
fwrite($fp, $text);
}If however I htmlentitise the text before writing to file I end up with £ instead. There is nothing odd about the space before the pound sign so I assume it is something to do with text encoding. What can I do to fix this?
Cheers
Lee
edit was to add solved-ish to subject