The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Campaign Create Special Characters in emailcontent

Highlighted
Participant

Campaign Create Special Characters in emailcontent

Trying to create a campaign and am hanging up on sending my EmailContent. Believe it has something to do with encoding the html being sent over. I am simply passing my HTML through htmlspecialchars in PHP 5.2.  Doesn't seem to do the trick though.


Reading through the same campaign form I noticed a series of string replacements being done on the XML before it get's sent over.


            $entry = $xml_object->asXML();

            $search  = array('>'    , '\"'    , '
'    , '

'    , '"/>'    , '&'        , '<'    , '�'        , '�');

            $replace = array('>'    , '"'    , ''        , ''        , '" />', '&'    , '<'    , 'Ÿ'    , 'ÿ');


 


Can someone explain why these replacements are needed?  I assume something to do with either the ATOM spec or how CC is implementing the ATOM spec or possibly both? I can see where a few elements passed in are run through htmlentities as well.  Should htmlentities be used instead of specialchars?


Thanks in advance for any pointers.

 

1 REPLY 1
Highlighted
Employee

Re: Campaign Create Special Characters in emailcontent

The EmailContent node would need to be HTML encoded in order to be correctly included in the XML you are sending in your http request. Unfortunately the individual that created this specific integration is no longer with us. I have been able to successfully remove this without an issue, but am not 100% why it is there. With that being said, we do have a new PHP library which is available on our Code Samples page which does not include this same issue.


 


I am going to take a closer look at this and see if I can come up with a scenario of why it is in the sample. I will respond to this post as soon as I have more information regarding this. Thank you.

David J

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured