Optimized string escaping.