codec/line: do charset conversion on flush

Also add tests to verify line codec does charset conversion on flush.