Reply
Occasional Participant
TeomanM3
Posts: 3
Registered: ‎01-16-2013

API connection does not support UTF-8 charset

Hello,

 

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

DaveBerard
Posts: 1,630
Topics: 7
Kudos: 61
Solutions: 57
Registered: ‎06-19-2008

Re: API connection does not support UTF-8 charset

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
Occasional Participant
TeomanM3
Posts: 3
Registered: ‎01-16-2013

Re: API connection does not support UTF-8 charset

[ Edited ]

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. 

we even used "ENT_SUBSTITUTE" and "ENT_DISALLOWED"

 

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

any help will be much appriciated. 

 

thx in adv. 

 

 

 

 

Occasional Visitor
ConstantC89
Posts: 2
Registered: ‎08-21-2012

Re: API connection does not support UTF-8 charset

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:

 

<?php

$sContent = mb_encode_numericentity(
$sContent,
array(0x80, 0xffff, 0, 0xffff),
'utf-8'
);

$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

Rhys Black
DaveBerard
Posts: 1,630
Topics: 7
Kudos: 61
Solutions: 57
Registered: ‎06-19-2008

Re: API connection does not support UTF-8 charset

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
New Member
FirstNameL64477
Posts: 1
Registered: ‎09-18-2013

Re: API connection does not support UTF-8 charset

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

DaveBerard
Posts: 1,630
Topics: 7
Kudos: 61
Solutions: 57
Registered: ‎06-19-2008

Re: API connection does not support UTF-8 charset

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