Skip to main content
August 23, 2018
Question

"Update Program" doesn't encode special characters correctly (specifically the em dash – as opposed to the hyphen - )

  • August 23, 2018
  • 6 replies
  • 4730 views

Our Ticket:

Repro steps:
1. Have an existing program in Marketo.
2. Update the name to include this dash – via the "Update Program" card.
3. The name in Marketo will now contain – instead of –
4. Creating a program with – via the Marketo UI does not result in the same issue.

This may be affecting more than just the Update Program card. Maybe look into the other Program related actions and make sure they don't do the same thing.

Dev response:

The api expects data to be sent with "Content-Type: application/x-www-form-urlencoded" Header.

So including this header encodes the em dash but not the hyphen.
Without this header the data is not getting updated.
I tried adding "charset:UTF-8" , base64 encoding and percent encoding nothing worked.
It is a limitation on Marketo API

The problem with the API is the data should not be encoded but the header "Content-Type: application/x-www-form-urlencoded" encodes em dash only not the hyphen.

That’s why — changes into –

Solution Path:

We are looking for a way to successfully update program Titles with the provided string, and without encoding changing the input which switches the em-dash "–" to a-acute "â".

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

6 replies

SanfordWhiteman
Level 10
August 26, 2018

Lito Nicolai​ please return to this thread and mark my answer as correct.

When people respond to your threads promptly, you shouldn't abandon them...

September 10, 2018

Thank you for your response Sanford, and my apologies for not promptly responding as you did.  I was just able to take a look at this today, and I have forwarded this to my developer.  I will come back and mark this answer as correct after the solution has been applied successfully.

SanfordWhiteman
Level 10
August 23, 2018

2. Update the name to include this dash – via the "Update Program" card.

Think you mean "endpoint," never heard "card" used this way.

The problem with the API is the data should not be encoded but the header "Content-Type: application/x-www-form-urlencoded" encodes em dash only not the hyphen.

Actually the HTTP header doesn't encode anything at all.

The header is intended to reflect encoding that you have done elsewhere. Often, calling an encoding routine also sets the header accordingly, or vice versa. But there's no automatic connection between the 2 in general (and it's easy to mess up by stating the wrong encoding for the actual payload).

You don't need to URL-encode the "–".   You can encode it (URL-encoded non-reserved characters always work) but you don't need to.

2. Update the name to include this dash – via the "Update Program" [API endpoint]

The api expects data to be sent with "Content-Type: application/x-www-form-urlencoded" Header.

I have no trouble at all including an emdash in the program name via the API.

The payload is just:

name=Program%20Lab%2016%20-%20API%20Creation%20-%20Updated%20-%20–

The Content-Type:

Content-Type: application/x-www-form-urlencoded; charset=utf-8

And it also works if the emdash is encoded:

name=Program%20Lab%2016%20-%20API%20Creation%20-%20Updated%20-%20%E2%80%93

It is a limitation on Marketo API

Nope. It's an error in your client code.