Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Filter the content as it could contain word special characters...
- $content = $row['post_content'];
- // First clean it all up...
- $content = htmlspecialchars($content);
- $content = htmlentities($content);
- // Secondly, replace UTF-8 characters.
- $content = str_replace(
- array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"),
- array("'", "'", '"', '"', '-', '--', '...'),
- $content);
- // Next, replace their Windows-1252 equivalents.
- $content = str_replace(
- array(chr(145), chr(146), chr(147), chr(148), chr(149), chr(150), chr(151), chr(133)),
- array("'", "'", '"', '"', '•', '-', '--', '...'),
- $content);
- $content = iconv("UTF-8", "UTF-8//IGNORE", $content);
Add Comment
Please, Sign In to add comment