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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -