I want to covert a simple string in Unicode like this:
simple string = `Pritesh & Nilesh is a good friend.`
And I want to get in this form:
string = `Pritesh & Nilesh is good friend.`
I want to convert to this type of string.
You need to use htmlentities() in php. This replaces all special html characters with their &xxxx; symbols. The PHP manual page is here for more info. For your example this would be:
However this won’t replace your spaces with line-breaks as these are considered standard html character and shouldn’t be necessary in 99.9% of cases anyway. However if really need this you can use either php for this:
Or javascript:
as done here