ameisez 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 Link to comment Share on other sites More sharing options...
Ingolme 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 " Link to comment Share on other sites More sharing options...
ameisez 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now