How to show all invisible characters in a string like \n or \r\n

As the stackoverflow question said: To see all the invisible characters not only \r, \n etc... It's good to see json_encodeed version and everything is »