'Prevent special characters from rendering in javascript

I am forming a curl command from the API response i received. The issue is that the response may contain special characters like '\n', '\u0012', '\t'. For example if the response contains:

body: "\n\[email protected]"

But on UI the unicode and line break characters are getting rendered:

<!--------line break is occurring ------>
[email protected]

I am using angularjs as framework. Can anyone tell me how can i prevent these special characters from getting rendered on UI. Any help will be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source