Improved handling of special characters