htmlspecialchars

php and special characters

Hi-- I'm trying to parse a string from a French text, and I'm using both htmlspecialchars and html_entity_decode-- but certain characters aren't getting properly converted. Any ideas? Here's the code: html_entity_decode(htmlspecialchars_decode($this->string($tstring))); // returned from web service In particular, the entity that isn...

htmlspecialchars removes formatting

i'm calling the htmlspecialchars function inside another function in a class, but when i do this, even though the data displays, it removes all formatting showing the data in a single line. this is the code: class Name { . .. . public function h($s) { echo htmlspecialchars($s, ENT_QUOTES); } public function ...

Formatting HTML code to be output in plain text, with PHP

Hi folks I have this function that takes some user-submitted HTML code from the database: function Code($code) { return "<pre><code>".nl2br(htmlspecialchars($code))."</code></pre>"; } I'll just be calling it like echo code($query->row('html'));. I know my question lacks 'depth', but is this the best way to do it? Or could the out...

php form security

I was reading an article about form security becuase I have a form which a user can add messages. I read that it was best to use strip_tags(), htmlspecialchars() and nl2br() Somewhere else said to use html_entity_decode() I have this code in my page which takes the user input <?php $topicmessage = check_input($_POST['message']);...

htmlspecialchars(): Invalid multibyte sequence in argument

Hi there, I am getting this error in my local site. Warning (2): htmlspecialchars(): Invalid multibyte sequence in argument in [/var/www/html/cake/basics.php, line 207] Does anyone knows, what is the problem or what should be the solution for this? Thanks. ...

Remove HTML special charcters

How do i remove “ , ” , ° like special characters from a string in PHP Actually i need to read the contents from a text file and need to remove the html special characters except the alphabets and digits from it ...