试图弄清楚这个解码。我想以最通用的文本结束。省略 '...' 单引号或双引号的花式引号,常规旧的 '-' 而不是 emdash。除了 str_replace 之外,还有其他方法可以使用花式与常规字符串的表吗?
$str = 'Hey,…I came back….ummm,…OK,…cool';
echo htmlspecialchars_decode($str, ENT_QUOTES) ;
// Hey,…I came back….ummm,…OK,…cool
echo html_entity_decode($str, ENT_QUOTES, 'ISO-8859-15') ;
// Hey,…I came back….ummm,…OK,…cool
echo html_entity_decode($str, ENT_QUOTES, 'UTF-8') ;
//this works, but changes to the elipse character
// Hey,…I came back….ummm,…OK,…cool
echo str_replace("…", "...", $str) ;
//Hey,...I came back....ummm,...OK,...cool
//desired result