Hi everyone, i created a web crawler in python and it gets data from specific parts in websites and stores this data in a mysql database which is later displayed in my website.
however when i display the data in my website it appears with weird characters like this:

After many years of theft, there�s still more to steal and Here�s how to reclaim forests,

notice the question mark in the triangle. when i used the function mb_detect_encoding, it tells me the data is in ascii yet the default collation is latin_swedish_ci, but when i save the data in the database i override the default and use utf-8 instead. please tell me what could be wrong. Thank You alot!!!!

Have you tries using htmlspecialchars(); when displaying? Not sure if it's the best way but it works. Or you can use the HTML purifier which can fix these issues but thats a little heavy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.