Added file encoding functions