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
3 answers

PHP: htmlspecialchars

I'm new to programming, and I'm trying to apply the htmlspecialchars to the script below, but all attempts have just resulted in error messages. I believe it should be something like: echo htmlspecialchars($lines), but not sure how this would apply…
K Green
  • 129
  • 1
  • 4
  • 16
-2
votes
1 answer

htmlspecialchars() why does not work on some chars

hi i was wondering but maybe i missed up somenthing about htmlspecialchars(), why does this function does not a replacement of all this html special character html special chars list cause for example the char % is not replaced as i can see the…
itsme
  • 48,972
  • 96
  • 224
  • 345
-2
votes
1 answer

Htmlspecialchars return a mistake value

I'm using PHP 7.4, when I run echo htmlspecialchars("Jours Fériés", ENT_QUOTES); I get an empty string. when I run echo htmlspecialchars("Jours", ENT_QUOTES); I get "Jours" How can fix this problem ?
-2
votes
2 answers

htmlspecialchars won't accept 'variable variables' as an argument

I'm through reading a book: "PHP and MySQL ® Web Development 4th edition" by Luke Welling & Laura Thomson. On page 49. author suggest additional esoteric (for me at least) way to deal with form. Namely, if names in html form have same values which…
perpetuum
  • 129
  • 10
-2
votes
1 answer

What do actually mean by 'invalid code unit sequences' in PHP? How do 'invalid code unit sequences' work in htmlspecialchars()? Need examples of it

So, I always need answers specific to PHP rather than generalized answers given by considering technologies other than PHP. I'm using PHP 7.3.3 on my laptop that runs on Windows 10 Home Single Language 64-bit operating system. I've installed the…
PHPLover
  • 1
  • 51
  • 158
  • 311
-2
votes
1 answer

How to get all the parameters(arguments) and their respective values including the optional ones, if any, of a built-in function in PHP?

I'm using PHP 7.2.10 I am using a built-in PHP function htmlspecialchars() Following is my code : Test", ENT_QUOTES); echo $new; ?> I want to pass all the parameters(arguments) of the function…
PHPLover
  • 1
  • 51
  • 158
  • 311
-2
votes
1 answer

how to convert new line and html code in htmlspecialchars in php

here is my string hello world how can I convert this string hello   world     <textarea>hello world</textarea> in php. Any one help please... I am try htmlspecialchars();…
-2
votes
1 answer

Which piece of code is 'better?'

I have two pieces of code. Can you please tell me which one is correct and more secure?
-2
votes
1 answer

Should I use htmlspecialchars inside tag

The title says it all. Should I include htmlspecialchars(); function inside tag? Thanks
zeeks
  • 775
  • 2
  • 12
  • 30
-2
votes
2 answers

Un-Escaping XML encoded characters

Hi I got response as like instead of STD xml. How Can i convert it into XML by using PHP .. …
user1806296
  • 41
  • 2
  • 11
-2
votes
1 answer

PHP - htmlspecialchars

I am attempting to use "htmlspecialchars" function to sanitize URLs. Below is the code: $new = htmlspecialchars("Test", ENT_QUOTES); echo $new; The anticipated output should be: <a…
Ryan
  • 59
  • 7
-3
votes
1 answer

I got a problem with this (htmlspecialchars)

Notice: Undefined index: id in D:\xampp\htdocs\inventarisrf\update.php on line 34 Data Gagal diupdate."; } } ?>
-3
votes
6 answers

Can't use htmlspecialchars in foreach loop with array, why?

I've working on some security stuff, and php is giving me some odd behaviour. Could you help me figure out what's going on? :) So, I have an array of inputs, like so $first_name = ""; $middle_name = 'Robert'; $last_name =…
-3
votes
1 answer

Which is faster for performance? htmlspecialchars or function?

i'm looking to see which is faster? I have a lot of users on the site at any given time and a lot of content to echo out. Which would be faster?: case 1: echo htmlspecialchars($_POST['name'], ENT_QUOTES); case 2: file 1: function cleanText($string)…
John Jaoill
  • 159
  • 2
  • 9
-3
votes
2 answers

Replace a single quote ( ' ) with another quote (’) str_replace

I am trying to replace a single quote (') with another quote (’), but I can't seem to get anything to work. Also, how can I make this work on multiple strings ($text, $title, $notice)? input: don't output: don’t I am trying this: $text =…
Aleza
  • 15
  • 4
1 2 3
31
32