modify encode to unix for mac & linux