Fix encode error when dealing with unicode filename.