Strip formatting and custom font from text entry questions | XM Community
Skip to main content

We have a large survey with 100k+ invites distributed per day. Every once in a while a customer will enter a response to a text entry question that has a custom font or italics that gets saved by Qualtrics in that way. While this does not break anything in Qualtrics, we export this data to go to an internal data warehouse, and this causes those systems to fail due to the unsupported characters.

 

Has anyone overcome this problem before? I imagine this can only be done with JavaScript. See an example below. The text doesn’t even seem to show differences when looking at the HTML, but when copying and pasting it to different sites it seems to maintain the variations in font.


I paid extra. 𝙽𝚘𝚛𝚖𝚊𝚕𝚕𝚢 𝙸'𝚟𝚎 𝚗𝚎𝚟𝚎𝚛 𝚑𝚊𝚍 𝚊𝚗 𝚒𝚜𝚜𝚞𝚎

 

Hi ​@jake_dufinetz , please see below JavaScript that shud sanitize user input by removing custom fonts, bold, italics, non-plain-text formatting, etc:

Qualtrics.SurveyEngine.addOnload(function() {
var qid = this.questionId;
var inputBox = document.querySelector(`#${qid} textarea`);

if (inputBox) {
inputBox.addEventListener("input", function () {
// Remove rich formatting by rewriting the input as plain text
const plainText = inputBox.value.normalize('NFKD').replace(/[\u0300-\u036f]/g, "");
inputBox.value = plainText;
});
}
});

I hope this helps.
-- Rochak
 


Hi ​@jake_dufinetz , please see below JavaScript that shud sanitize user input by removing custom fonts, bold, italics, non-plain-text formatting, etc:

Qualtrics.SurveyEngine.addOnload(function() {
var qid = this.questionId;
var inputBox = document.querySelector(`#${qid} textarea`);

if (inputBox) {
inputBox.addEventListener("input", function () {
// Remove rich formatting by rewriting the input as plain text
const plainText = inputBox.value.normalize('NFKD').replace(/[\u0300-\u036f]/g, "");
inputBox.value = plainText;
});
}
});

I hope this helps.
-- Rochak
 

Thank you Rochak, I will need to give it a try!!