Another PHP UTF-8 problem: htmlentities, htmlspecialchars and html_entity_decode
Aug 6, 2007
htmlentities, htmlspecialchars and html_entity_decode have 3 parameters:
- string to be converted
- quote_style
- charset
but charset default is ISO-8859-1 and there’s no way to change that default, what happens if you’re porting 1,000,000 lines of code from ISO-8859-1 to UTF-8? you’ve to wrap those functions or patch every call passing all the 3 params. All these 2 solutions are bad solutions.
PHP should implement a customizable default, maybe also reading mbstring.internal_encoding if available.
Filed in: PHP









Post a Comment