phphtmlmarkuphtml-encode

Online or offline text to html entities converter


Does anyone know of any online or offline software that will take, say, a paragraph of text with quotes and other characters in it and convert it to html entities ?

I am not looking for the normal alphabetic characters to be converted, just the quotes and dashes etc.

Reason I ask is that we have a copywriting department who insist on using Word for writing copy for websites but copying and pasting this into a site whilst having to find the strange characters is time consuming and tedious.


Solution

  • PHP functions htmlspecialchars makes this easy. You can easily make a small html form who posts to a php script that write out the result.

    PHP:

    echo htmlspecialchars($_POST['input']);
    

    HTML:

    <form method="post">
    <textarea name="input"></textarea>
    </form>
    

    http://php.net/htmlspecialchars