php - htmlentities() not working properly on web hosting server -


i'm using htmlentities() on user-inputted data , on local server there no problems. however, when run code on web hosting server character encoding seems messed up.

example (using string åäö áàâ);

local server [message] => åäö áàâ  output = åäö áàâ 

however result on web hosting server is

web hosting server [message] => ã¥ã¤ã¶ ã¡ã ã¢  output = åäö áà â 

the "charset problem" occurs when applying htmlentities() string. how fix it?

i fixed , cause of problem;

according php.net, php versions prior 5.4.0 has 'iso-8859-1' default encoding. had change 'utf-8' in;

htmlentities($string, ent_compat | ent_html401, 'utf-8'); 

(this first thing tried though, wrote 'utf-8' in lower case didn't work!!)


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -