segment.py: file encoding