Questions tagged [htmlspecialchars]

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

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

Famous question: htmlentities() vs. htmlspecialchars()

467 questions
-1
votes
1 answer

CakePHP Validator not working form entity

I want to perform a htmlspecialchars with no quotes in my entity save. Code: $post['body'] = htmlentities($this->request->getData('body'), ENT_NOQUOTES); Validator doesn't work on save. How to make it work? Thanks
-1
votes
2 answers

Cannot replace some html characters with str_replace()

From the database I receive the following text: <div onclick="alert('código…
-1
votes
1 answer

How and where exactly is htmlspecialchars() or {{}} to be used?

When is the htmlspecialchars() to be used exactly? I know that laravel {{}} is automatically escaping, but I have a case where I don't know how to implement {{}} - see "view" example, so I would go instead for htmlspecialchars() . As far as I know…
-1
votes
2 answers

HTML special characters not displayed properly

I have two PHP files and when I fetch data from database on these pages and display them using print_r both the pages display content in different way. Actually I have some HTML special characters in my content with I have escaped using…
Nikhil Gaur
  • 1,280
  • 3
  • 19
  • 40
-1
votes
3 answers

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
raki
  • 2,253
  • 8
  • 33
  • 42
-1
votes
1 answer

Escaping and HTML special characters

I am escaping data prior to DB insertion using: $entry = mysqli_real_escape_string($link, $value); and then using htmlspecialchars() on the output before displaying, however in my output I appear to have slashes within the string, as in It\'s not…
Ryan
  • 767
  • 3
  • 9
  • 31
-1
votes
6 answers

Undefined index when calling htmlspecialchars

I'm getting the following error: Notice: Undefined index: test With reference to this line: $token = htmlspecialchars($_GET["test"]); Do I need to define test somewhere even though I'm trying to read it from a URL? - -EDIT- I had actually looked…
Robert
  • 5,278
  • 43
  • 65
  • 115
-1
votes
3 answers

How to store input text value or text area value with & symbol and special characters?

I have already checked with htmlentities, htmlspecialchars, mysql_real_escape_string but nothing helped me. I just want to save "Hello my name is john & my native is chennai" when i tried to save this, only "Hello my name is john " is saved. what…
-1
votes
1 answer

Want to use htmlspecialchars , but Hypelinks must be clicakble in view - PHP , HTML

Hi I am implementing a comment system . When showing my comments and articles in my view again , i want to use htmlspecialchars but i want my hypelinks can be clicked . Example Comment : My favourite web site is < www.facebook.com >. Then i the…
Kanishka Panamaldeniya
  • 17,302
  • 31
  • 123
  • 193
-1
votes
1 answer

htmlentities not giving wanted result

I have the following function below how ever the result is still giving me string(13) "hell'o"o" and not the special chars Function: private function makeHTMLSpecial($input) { return htmlentities(trim($input), ENT_QUOTES); …
Jess McKenzie
  • 8,345
  • 27
  • 100
  • 170
-1
votes
1 answer

htmlspecialchars ignores some characters

I use htmlspecialchars() to escape some text, but for characters like ™ it outputs nothing. I know this is because it isn't valid UTF-8 but how can I let htmlspecialchars() ignore that, store it in a database and then display the characters on a…
Jonan
  • 2,485
  • 3
  • 24
  • 42
-1
votes
4 answers

Replace Quotes from xml in php

I want to replace some quotes from an xml doc and use a php function for that. It works fine with all chars, besides this one: I tried thes unicode chars but did not suceed: '“', '”', '„', '″' In my optinion the first one…
user998163
  • 471
  • 1
  • 9
  • 28
-1
votes
2 answers

How to convert html special characters into their codes using php

Actually I want to convert all the special characters into their codes as I've shown below: ! ! " " # # $ $ % % & & ' ' ( ( ) ) * * + + , ,…
Manish Jangir
  • 131
  • 1
  • 3
  • 10
-1
votes
1 answer

htmlspecialchars() throwing an error

I have installed elgg and none of the links work. In the error log, I see a slew of these error messages: htmlspecialchars() expects at most 3 parameters, 4 given
steve landiss
  • 1,833
  • 3
  • 19
  • 30
-1
votes
5 answers

Delete special char \

How can i delete a html-special char \ from a string. $string = 'This is \ a string with \ special characters \';
Raymond van Os
  • 191
  • 1
  • 5
  • 18