Microsoft outlook unusual characters

When I type three dots in Microsoft Outlook email, these characters are converted into special character and it needs special handling especially when it is stored in database and we want to retrieve and display it in web page.

function convert_raw_utf8_smart_quotes($string)
{  
	$search = array(chr(0xe2) . chr(0x80) . chr(0x98),
	                  chr(0xe2) . chr(0x80) . chr(0x99),
	                  chr(0xe2) . chr(0x80) . chr(0x9c),
	                  chr(0xe2) . chr(0x80) . chr(0x9d),
	                  chr(0xe2) . chr(0x80) . chr(0x93),
	                  chr(0xe2) . chr(0x80) . chr(0x94),
	                  chr(0xe2) . chr(0x80) . chr(0xa6));
 
	$replace = array('‘',
  	                   '’',
	                   '“',
	                   '”',
	                   '–',
	                   '—',
	                   '...'); 
 
	return str_replace($search, $replace, $string);
}

Leave a Reply