csv encode/decode utility functions