Create two files and check them

The two files have different charset and line separator. see details the below.

filename line separator charset contents
filesjis.txt CR LF sjis 1行め 2行め
fileutf8.txt LF utf8 1行め 2行め

I just wanted to know how to write and read files using charset.
If a file has line separator CR&LF or LF, the file can read correctly.

  • The result is below

f:id:tomoTaka:20160621165222p:plain

  • The files contents
cat filesjis.txt| iconv -f sjis -t utf8
cat fileutf8.txt

f:id:tomoTaka:20160621165234p:plain