Hi,
We’ve recently found out our payment widget isn’t normalizing accented characters in customers last names and so at the end of the form the widget doesn’t load the capita interface.
We’ve got a composite that combines - title, first name and last name fields and a rule that then passes those (when any value in those fields changed) to another field called ‘full name’. This is then used as the reference in our widget for bringing the full name over into capita.
I’ve noticed whilst investigating the issue that the code we’ve got in currently works to normalize an accented character in the first name field but not for the last name for some reason (even though they’re not different settings wise in the composite).
let card_holder_name_trim = card_holder_name.normalize(‘NFD’).replace(/[\u0300-\u036f]/g, ‘’);
card_holder_name_trim = card_holder_name_trim.substring(0,50);
(Above works for the singular field o ‘address line 1’ and it’s also working for separate fields in our personalization’s for gov.uk notify emails so I’m guessing it’s something up with fields being in the composite but I’m not sure what to try next…)
I’ve tried adding in a conversion function step into the rule that copy’s the field values from the composite to the full name field used in the widget but again that’s not having any affect on the last name accented characters.
(field processor)
return params.input ? params.input.normalize(‘NFD’).replace(/[\u0300-\u036f]/g, ‘’): params.input;
We’ve also tried another solution for encoding the string but although this works it doesn’t replace the characters nicely and it’s turning spaces in composite to 20%.
let card_holder_name_trim = encodeURIComponent(card_holder_name).substring(0, 50);
Just wondering if anyone has come across this before and if so how did they manage to resolve? - Or do others use something else for normalising characters?
Thanks and kind regards,
Erin