php - Proper character encoding to display "”"? -


i'm having nasty character encoding problems can't figure out.

essentially, i'm screen scraping html off of site using php, running through php's domdocument change out url's, etc., , when it's done, outputs html weird things. ex: there should end quote, puts out ”

i have page's meta tag charset set utf-8 ” characters showing รข€ on site. i'm not sure if don't understand character encoding, or what.

any suggestions on best way resolve this? client side meta tag, or kind of server-side php conversion?

sometimes setting charset in html or response header isn't enough. if isn't setup utf-8 on server, text may incorrectly converted somewhere along way. may need enable utf-8 encoding both apache , php right in config files. (if you're not using apache, try skipping step.)

apache utf-8 setup:

edit either charset.conf (ideal), or httpd.conf file, adding line end:

adddefaultcharset utf-8 

(if don't have access apache's config files, can create ".htaccess" file in html's root directory same code.)

php utf-8 setup:

edit php.ini file, searching "default_charset", , change to:

default_charset = "utf-8" 

restart apache:

depending on server type, command may trick via command line:

sudo service apache2 restart 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo