br3nn4n Posted May 19, 2009 Share Posted May 19, 2009 I'm copying some text from a Word doc (that's how the people I'm doing this for insist on doing things) and I'm running into the problems with the site ending up showing non-characters. I'm running all my text through this before it's inserted into the database: <?PHP $article = ereg_replace(38, "&", $article); // ampersand $article = ereg_replace(133, "…", $article); // ellipses $article = ereg_replace(8226, "″", $article); // double prime $article = ereg_replace(8216, "'", $article); // left single quote $article = ereg_replace(145, "'", $article); // left single quote $article = ereg_replace(8217, "'", $article); // right single quote $article = ereg_replace(146, "'", $article); // right single quote $article = ereg_replace(8220, """, $article); // left double quote $article = ereg_replace(147, """, $article); // left double quote $article = ereg_replace(8221, """, $article); // right double quote $article = ereg_replace(148, """, $article); // right double quote $article = ereg_replace(8226, "•", $article); // bullet $article = ereg_replace(149, "•", $article); // bullet $article = ereg_replace(8211, "–", $article); // en dash $article = ereg_replace(150, "–", $article); // en dash $article = ereg_replace(8212, "—", $article); // em dash $article = ereg_replace(151, "—", $article); // em dash $article = ereg_replace(8482, "™", $article); // trademark $article = ereg_replace(153, "™", $article); // trademark $article = ereg_replace(169, "©", $article); // copyright mark $article = ereg_replace(174, "®", $article); // registration mark ?> It seems to work, but honestly I don't know if it works on Macs (they use Macs) the same it does on Windows. What I'm wondering now is this -- is it even necessary to convert the curly quotes? Or would they, since my site is UTF-8, show up normally without doing anything to them? Can someone shed some light? Thanks Link to comment https://forums.phpfreaks.com/topic/158782-word-special-quote-problem-dear-god-why-cant-this-just-work/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.