API connection does not support UTF-8 charset


API connection does not support UTF-8 charset



We have an API conncetion to send campaigns. However, via API connection, UTF-8 charset are not supported for the html content while the panel supports it. As this is an important issue for us, we need your support as sson as possible.


Thank you


We do not natively support UTF-8 anywhere in our product, either UI or API.  Our native character encoding is ISO-8859-1, Latic Character Set.  Our UI does allow you to copy/paste or type in UTF-8 characters, however we encode them to the HTML entity values instead of storing them natively.  This is the same support we offer through the API, only the content must be HTML encoded into entity values prior to sending it to us.  Depending on the language you're using to develop, there are different methods or libraries for doing this encoding.

Dave Berard
Senior Product Manager, Constant Contact

hi there,


we tried utf-8 since it is the defacto-standart at this part of the world (hi from europe btw :) )

$temp_gonderilecek_icerik = htmlentities($temp_icerik, ENT_QUOTES, "UTF-8";);

it didnt work. 


then tried  "american" standart charset  like this one: 

$temp_gonderilecek_icerik = htmlentities($temp_icerik, ENT_QUOTES, "ISO-8859-1");  



even tried to change characters with iconv: 

$temp_icerik = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $temp_icerik);

then send it again: 

$temp_gonderilecek_icerik = htmlentities($temp_icerik, ENT_QUOTES, "ISO-8859-1");


$myCampaign->emailContent = $temp_gonderilecek_icerik;


none of these helped us. 



anyway we are looking forward to find any kind of solution here.

any help will be much appriciated. 


thx in adv. 





Occasional Participant

You need to:


1.) use XHTML campaigns instead of HTML campaigns,

2.) encode unicode characters outside the ASCII set, and

3.) doubly encode the ampersand entities


The following PHP code snippet may help:



$sContent = mb_encode_numericentity(
array(0x80, 0xffff, 0, 0xffff),

$sContent = str_replace('&#', '&amp;#', $sContent);



In this manner, you may get it to work.


Really, though, it'd be better to support UTF-8, because it's been on the development road map for a couple years and at the top of every file returned from the API it states that the encoding is UTF-8.


Good luck!



Rhys Black

Thanks for the code snippet Rhys!  We are working to migrate our different products, services and databases to UTF-8 support and have been over the past couple of years.  As you can imagine, this is a very large project for us as we have hundreds of thousands of active users who have active data, campaigns and old campaigns and data that would need to all be migrated without issue.  We take data integrity and the customer experience very seriously and are being very dilligent in every data migration we do.  I can't provide any sort of timeframe, but we are looking at this very seriously and all of our new products are designed with UTF-8 up front.  It's simply a matter of time and resources to continue to migrate old systems and data at this point.

Dave Berard
Senior Product Manager, Constant Contact

Do we still have any issues? I believe all the issues resolved in the newer templates and codes...

At this time, we do not offer full UTF-8 support natively in some of our applications.  We are continuing to migrate to UTF-8 as we update and upgrade various parts of our product, but there are some that are still not there (specifically anything involving email content).  We will continue to work on this and update when we have more information to share.

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page