You might want to check out PHP htmlentities and htmlspecialcharacters.
typoknig
2010-10-03 04:11:17
You might want to check out PHP htmlentities and htmlspecialcharacters.
Note: You are using jQuery.post()
and setting your data as a $_GET parameters
. It should be called like;
$.post("/php/getFile.php", { action: "write", file: file, newcfg: newcfg },
function(data){
alert("Data Loaded: " + data);
});
You can keep your line breaks with a function like this:
function splitter($content) {
$content = str_replace(chr(10),'<br/>',$content);
$content = str_replace("<br/><br/><br/><br/>","<br/><br/>",$content);
return $content;
}
Which you run like:
$newcfg = splitter($newcfg);
And typoknig is right abouit special chars