Tool that returns htmlspecialchars(htmlentities()) of any input

This tool is here due to possibility of saving a web document as a file instead of serving it from a database server. Everything is OK with saving as long as the document is in English language, however different encodings may cause problems when saving, opening and serving a file. That’s why this tool exists. I personally use this „no database use” technique at FishPonds.Biz.

htmlspecialchars is a PHP function that converts special characters to HTML entities.

htmlentities is a PHP function that converts all applicable characters to HTML entities.

 

Code example

<?php //passes input through htmlspecialchars(htmlentities()) and does echo $str[] = "\"this is beginning of input...\" „Just an example”"; echo "<div><h2>The result is following</h2> <textarea cols="100" rows="15" readonly>". htmlspecialchars(htmlentities($str[0], ENT_QUOTES , "UTF-8")). "</textarea><p>Bear in mind it’s necessary to call <mark title="htmlspecialchars_decode() will perform decoding of encoded strings">htmlspecialchars_decode()</mark> function over the above-shown result to make HTML tags working!</b></div>"; ?>

Other tools & help

If you need help with PHP scripting, Apache setup and server-related situations, drop me a line. You’re also welcome to visit other tools - they’re listed below.