strip URL of \n, \r, and trap other errors