Check if a string is escaped before escaping it to avoid double escape