Improved special character handling