added function to replace all escaped characters in a string