Fix unicode issues when metadata or content has non ascii characters