0

While rendering huge html strings using jQuery, some of the HTML strings contains folder paths like c:\test\new, d:\test\both

For example:

this is test, find the path below

c:\test\new, d:\test\both

As you can see on the above path there are escape sequences like \b and \n which are not displaying properly on div after rendering.

They will display as c:\test ew, d:\test oth

1. this is test, find the path below
    **c:\test ew**, **d:\test oth**

Is there any way to escaping these escape sequences in html strings? or just to replace with \b to \\b, \r to \\r in the html string?

If I'm trying to replace these escape sequences. the problem is with \n to \\n. there are other instances of \r\n as this bring an html string. which is messing up the entire html rendering.

<span id=\"ms-rterangepaste-start\" style=\"font-family:verdana;font-size:10pt\"></span>\r\n<div style=\"font-family:verdana;font-size:10pt\"><span style=\"font-size:10pt\">Copy the most recent Microsoft .NET Framework 4 set file under folder \\ASP.NET\\4.0 to the </span><span style=\"font-size:10pt\">local server (e.g., D:\Software\notes\).</span></div>\r\n<div style=\"font-family:verdana;font-size:10pt\"><span></span> </div><span><span id=\"ms-rterangepaste-start\"></span>\r\n<ul>\r\n<li>\r\n<div style=\"font-family:verdana;font-size:10pt\"><span style=\"font-size:10pt\">Double-click to start the upgrade process.</span></div></li>\r\n<li>Check th option to accept the license and click Install</li>\r\n<li>Click Finish once installation is complete</li>\r\n<li>After install, if prompted by Windows Update, apply any required patches for .NET</li>\r\n<li>Reboot server</li></ul></span>***

The html string will look something like this.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
dev548
  • 1
  • 1
  • 1
    Possible duplicate of https://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery – Jeto Mar 16 '18 at 18:37
  • I dont have issues with html escapes like <, >,&,/. The issue i have is with escape characters sequences \b ,\n ,\r, \f. as mentioned above. – dev548 Mar 16 '18 at 18:54
  • What do you mean by HTML strings then and where do they come from? Please post some code. – Jeto Mar 16 '18 at 18:59
  • The data currently is stored in SQL db, initially came from Sharepoint multi rich text box – dev548 Mar 16 '18 at 19:55

0 Answers0