Advertisement

07.23.2008 at 12:58PM PDT, ID: 23589945 | Points: 500
[x]
Attachment Details

PHP - Email - Microsoft 'smart' quotes

Asked by mcorsi62 in PHP Scripting Language

I moved a bunch of php code over to a new server. Part of the code was responsible for gerating a daily email. The editor uses Microsoft Word. On the old server, the code ran fine (PHP 4.x; Apache 1.4) however on the new server (PHP 5.x; Apache 2.x) the code looks fine all the way till the reception of the email. The email displays gibberish in place of the MS 'smart' quotes.

So - I decided to just get rid of the smart quotes before sending. The code I need to clean up looks like this if you open it in VI :

 This is a double quote open  -     â<80><9c>   and   a  close   â<80><9d>^M
<p>^M
This is a single quote open  --  Ã¢<80><98>    and   a close  --    Ã¢<80><99>  

I found a few lines of code on the net to replace these stupid characters. it is:

$chrs = array (chr(150), chr(147), chr(148), chr(146));
$repl = array ("-", "\"", "\"", "'");
$HTMLcontent = str_replace($chrs, $repl, $HTMLcontent);


However, it does not recognize and replace the smart quotes so I am still left with gibberish in the email. The gibberish looks like this:


This is a double quote open - â¬S and a close ⬝
This is a single quote open -- â¬Ü and a close -- â¬"


Any suggestions on how to get this problem resolved?


Start Free Trial
[+][-]07.23.2008 at 02:09PM PDT, ID: 22073877

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 02:04PM PDT, ID: 22115646

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.13.2008 at 10:12AM PDT, ID: 22223685

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628