html - PHP: utf-8 encode, htmlentities giving weird results -
i'm trying data post form. when user inputs "habláis", shows in view source "habláis". want convert "habláis" purposes of string comparison, both utf8_encode() , htmlentities() outputting hablã¡is, , htmlspecialchars() nothing. use str_replace won't recognize á when searches string.
i'm using charset of utf-8 consistently across pages. idea what's going on?
i'm not sure if problem, calling htmlentities utf-8 parameter? ask because that's not default:
like htmlspecialchars(), takes optional third argument charset defines character set used in conversion. presently, iso-8859-1 character set used default.
so might want try calling function this:
$output = htmlentities($input, ent_compat, 'utf-8'); does solve problem?
Comments
Post a Comment