• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MS smart quotes

#1
[eluser]Unknown[/eluser]
Hello All,

I wonder if there is anything in CodeIgniter functions that replace MS smart quotes with normal quotes ??

like :

function fixMsSmartQuotes($string) {
$text = 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("'", "'", '"', '"', '-', '--', '...'),
$string);
// Next, replace their Windows-1252 equivalents.
$text = str_replace(
array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)),
array("'", "'", '"', '"', '-', '--', '...'),
$text
);
return $text;
}

i faced this problem when user try to copy text from word document and paste it into a textrea input and insert it into database where the text will truncated when it encounter any smart quote.
there is no sql error during the insertion.

Thnkas Kayed Qunibi


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.