Fixing garbled htmlentities output by using the proper charset
If you’re running user-provided text through htmlentities and it’s coming out garbled, it’s likely that the page’s charset doesn’t match the one you used to encode the text. First, we confirm the encoding charset. Starting with PHP 5.4, the default charset is UTF-8, so assuming you’re running a reasonably modern version of PHP and you […]