Snippets v2

Languages
My Snippets

Convert Smart Quotes back to normal Login or Register to Bookmark this snippet

Description PHP

Replaces right side, and left side quotes and double quote characters with normal single and double quotes. Useful for interpreting text from a WYSIWYG editor, when someone has pasted content from Word.

The Code Download
  1. <?php
  2. function convert_smart_quotes($string) {
  3.     //converts smart quotes to normal quotes.
  4.     $search = array(chr(145), chr(146), chr(147), chr(148), chr(151));
  5.     $replace = array("'", "'", '"', '"', '-');
  6.     return str_replace($search, $replace, $string);
  7. }
  8. ?>
Credits Contact JC

Added by JC on 11th November, 2007

Comments

There are no comments about this snippet.

Post Comment HTML is allowed

You must be registered and logged in to post a comment.

Login here to post a comment