Campaign Create Special Characters in emailcontent

Regular 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.



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