Write a function to reverse a string or check for palindromes, ensuring edge cases like spaces and special characters are handled.