Encoding issues in questions/answers

Hi Team,

I am in the process of developing a Facebook Quizbot using your API. Very good job on how simple you have set this up.

However, many a time, I come across encoding issues, like &quot, or &amp and so on…

I am a non-techie and I use Manychat platform to build the quizbot. I have been breaking my head for the past two days to get this problem fixed, but to no avail.
It will be great if you can decode the questions and answers…

very nice nice

1 Like

The question, correct_answer and incorrect_answers fields are all encoded to ensure the JSON string returned is valid. This means characters that may escape the string, such as ", are converted to HTML entities, such as " by default.

Unfortunately, the API has no option for JSON escaped strings. This means you need to manually decode these fields before displaying them to the user.

I don’t know what Manychat allows for, as I’ve never used it, but you’ll need to decode these fields to get the human-readable equivalent. If there’s no function to decode HTML entities, you can change the encoding by adding encode=urlLegacy, &encode=url3986 or &encode=base64 to the end of your API URL. Maybe Manychat has a base64 decode function.

1 Like

FYI for anyone who finds this post trying to save the same problem (like I did) - I found that I was able to correctly decode the entities in simple Javascript by using the &encode=base64 setting and then running atob() function to decode the strings (https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding)

Uh I tried base64 but once an accented letter appears, the decoding just breaks. Do you know how to decode default html?