Why would you think you need to strip anything from the input? The failing assertion is telling you the output contains the new line character.
There's also no need to keep quoting someone's post in its entirety.
There's also no need to keep quoting someone's post in its entirety.