htmlentities($this->value, ENT_QUOTES)
// The ENT_QUOTES parameter in the htmlentities() function ensures that single quote characters are encoded, since by default they are not (though double quote characters are). htmlentities() also encodes other characters and is useful for ensuring that characters such as "<" and "&" are not interpreted as HTML special characters.
// source: http://www.primitivetype.com/articles/quotes_inputs.php