Move to io module instead of codecs to fix universal line mode support when giving encoding.