My store record has some special characters as follows
name: "Hi \r\n\r\n Location Name: Hello\r\n\r\n"
But when it is displayed on UI (using XTemplate), the special characters are not displayed but not even applied. They are just discarded.
//XTemplate
    var cars_template = new Ext.XTemplate(
'<tpl =".">',
'<div class="cars-item">',                 
'<li>',
'<span>Name: </span><span>{[this.updateHtml(values.name)]}</span>',
'</li>',
'</div></tpl>',
{
  updateHtml: function(value){
    if(value){
      value = value.replace(/(?:\r\n|\r|\n)/g, '<br/>');            
    }
    return value;
  }
}
); 
 
                        
That is because the newlines are not html, they need to be converted to their html equivalent
<br/>one way or another.So for a string you could convert new lines like this:
Thanks to Emissary, there is a built in function in
ExtJSto convert to<br />:Ext.util.Format.nl2br(value)Here is a sencha fiddle with a working example to a
dataviewand below is the corresponding code:I
console.logthe change and this is replacing new lines with<br />.