encoding - Is there a PHP function to fix this? -
"“excuse me, hope isn’t weird or anything,"
how can fix encoding on this?
what you're running result of data being written in 1 encoding, , interpreted being another. need make sure you're requesting input in same format you're expecting in. recommend sticking utf-8 whole way through unless need avoid multibyte characters, in case might want @ forcing ascii.
make sure you're telling php use utf-8 internally:
ini_set('default_charset', 'utf-8');
and make sure telling browser expect utf-8 encoded text, both in headers…
header("content-type:text/html; charset=utf-8");
…and in meta tags (html5 below)…
<meta charset="utf-8">
setting tell browser sent utf-8 encoded content when form submitted, , it'll interpret results send utf-8 well.
you should make sure both database storage , connection encoding in utf-8 well. long dumb data store (i.e. won't manipulating or interpreting data in way) doesn't matter, it's better have right run problems later.
Comments
Post a Comment