Inconsistent character escaping