-2

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 ?

  • 4
    https://3v4l.org/HHPF5 - looks ok to me. Please provide a [mre] of your issue. – ADyson Jun 07 '22 at 14:01
  • 1
    What encoding is your string in…? The problem is that `htmlspecialchars` assumes the wrong encoding. – deceze Jun 07 '22 at 14:04
  • I'm using UTF-8 – mourad semi Jun 07 '22 at 14:06
  • hi mourad, as adyson pointed the output do looks alright. there are several possible cause to your problem. one of them is character encoding, specifically the html output which dictated on [`charset`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) which can be sent via http headers or meta tags. do make sure they are not conflicting. another thing to check, if the source of the string came from database, make sure it has the correct charset too. all we can do is just guess work as we cant replicate your problem. – Bagus Tesa Jun 07 '22 at 14:11
  • To confirm if it's an encoding issue, try using `bin2hex` to dump a hexadecimal representation of the binary string, and compare it against this output: https://3v4l.org/tUmRV – IMSoP Jun 07 '22 at 14:15

1 Answers1

0

Solved by changing encoding to "iso-8859-1" inside php.ini