0

I have an issue with special characters. I've uploaded text with special character with Salesforce Inspector, and the text displays well when I look in the console.

enter image description here

However, when I go in the Community Portal, the special characters becomes "\u2013" for en-dash or '\u2019' for apostrophe in the lightning component :

enter image description here

Has someone already got the same issue ?

ETA: Here's the code rendering the text:

({
drawColorways : function(component, helper) { 
    var storySectionDiv = document.getElementById('story-contenu');
    storySectionDiv.innerHTML = '';
    var storySectionDiv = document.getElementById('story-contenu');
    storySectionDiv.innerHTML = '';
    var storyBodyDiv  = null;
    var bodyRightDiv = null;
    var storyHeaderStyle = null;
    var bodyDescriptionDiv = null;
    var bodytitleSpan = null;
    var bodyDescriptionSpan = null;
    var blackBarDiv = null;
    storyTellingObject = component.get("v.storyTellingObject");


    // body text div
    bodyRightDiv = document.createElement('div');
    bodyRightDiv.setAttribute('class','bodyRightDiv');
    // title of description text
    bodyDescriptionDiv = document.createElement('div');
    bodyDescriptionDiv.setAttribute('class','bodyDescriptionDiv');
    var br = document.createElement('br');
    bodytitleSpan  = document.createElement('div');
    bodytitleSpan.innerHTML = storyTellingObject.titleDescription;
    bodytitleSpan.setAttribute('class','bodytitleSpan');
    // description
    bodyDescriptionSpan  = document.createElement('div');
    bodyDescriptionSpan.innerHTML = storyTellingObject.description;
    bodyDescriptionSpan.setAttribute('class','bodyDescriptionSpan');
    blackBarDiv = document.createElement('div');
    blackBarDiv.setAttribute('class','blackBarDiv');
    bodyDescriptionSpan.appendChild(br);
    bodyDescriptionDiv.appendChild(bodytitleSpan);
    bodyDescriptionDiv.appendChild(bodyDescriptionSpan);
    bodyDescriptionDiv.appendChild(br);
    bodyDescriptionDiv.appendChild(blackBarDiv);


    bodyRightDiv.appendChild(bodyDescriptionDiv);
    storyBodyDiv.appendChild(bodyRightDiv);
    storySectionDiv.appendChild(storyHeaderDiv);
    storySectionDiv.appendChild(storyBodyDiv);


},

})

  • How is the text being rendered in the community page: via a custom component or a field within community record detail page ? – Shamina Nov 29 '19 at 9:36
  • It's a custom component – tiph Nov 29 '19 at 10:10
  • 1
    to better help on this, could you edit your question and provide the code of the custom component ? so that we can see the logic you are applying to render the text – Shamina Nov 29 '19 at 10:18
  • thank you, I've updated my question – tiph Nov 29 '19 at 11:05
  • not sure why you are using document.getElementById. can you also provide your .cmp markup code and explain what you are trying to achieve with this component ? – Shamina Nov 29 '19 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.