Properly escape \r in strings.