Welcome Guest, Not a member yet? Register   Sign In
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


Messages In This Thread
MS smart quotes - by El Forum - 02-02-2010, 01:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB