Forum Discussion
luk
2 years agoBoss
Double posting to prevent that exact bug form happening to my post above 😉...
So the issue is that the content encoder Khoros uses is a bit dumb, it just checks character by character and does not check if an ampersand is part of an already encoded HTML entity... not sure if that is something we can fix, other than using JavaScript (which I did to solve the problem in the SEO field, but i should probably re-visit that code and expand it to all content...) on the editor Pages and un-encode any existing "&" into "&" within form fields...
This is the code i used for that (which i need to update it seems):
// Handle & ampersand bug in SEO field of Article (TKB, more?) Editor Pages
// & get replace with & but each time the article is saved again, the & of the &
// gets encoded again, resulting in continuous encoding, e.g. &
if ( $('.lia-form-message-seo-description-input, .lia-form-message-seo-title-input').length ) {
$('.lia-form-message-seo-description-input, .lia-form-message-seo-title-input').each(function() {
$(this).val($(this).val().replaceAll(/amp;/gm, ''))
});
}