[fix] cross-platform way to handle encoding issues