fix mac os issue with illegal byte sequence