What does the $encoding parameter of htmlspecialchars() do?

45 views Asked by At

I am working with the htmlspecialchars() function in PHP which takes an optional third parameter $encoding.

According to the official documentation of htmlspecialchars(), $encoding is...

An optional argument defining the encoding used when converting characters.

Now, I don't understand which encoding is the documentation talking about here. Does $encoding specify the encoding of the string that's input to htmlspecialchars() or the encoding of the string that's returned by the function?

And, as far as I see it, I don't think that there's a point of specifying the encoding. Can anyone please also give me an example of where would specifying the encoding make sense?

0

There are 0 answers