ameisez 0 Posted December 10, 2011 Report Share Posted December 10, 2011 (edited) I got this code to edit/save a specific text file online. <?phpif($_POST['Submit']){$open = fopen("b1.txt","w+");$text = $_POST['update'];fwrite($open, $text);fclose($open);echo "File updated.<br />";echo "File:<br />";$file = file("b1.txt");foreach($file as $text) {echo $text."<br />";}}else{$file = file("b1.txt");echo "<form action=\"".$PHP_SELF."\" method=\"post\">";echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">";foreach($file as $text) {echo $text;}echo "</textarea>";echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n</form>";}?> This works fine except when I input special character from ISO 8859-1 Characters. How can i make it save all special characters in "Entity Number Format" so that when it is read back it will show the special character? For example, when I enter Hello Günter it should be saved as Hello Günter Thanks Edited December 10, 2011 by green_apple Quote Link to post Share on other sites
Ingolme 1,019 Posted December 10, 2011 Report Share Posted December 10, 2011 You can use the PHP htmlentities() function to convert every special character to an entity.You'll need to use the ENT_XML1 flag to ensure it uses numbers on all characters except < > & ' and " Quote Link to post Share on other sites
ameisez 0 Posted December 11, 2011 Author Report Share Posted December 11, 2011 Hi, Thanks a lot for your reply. Seems like this is all I need. I will check it out tonight. Thanks again. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.