問題
ISO-8859-1のfileをUTF-8へ変換するiconvの指定はどれか。
- A
iconv -f UTF-8 -t ISO-8859-1 latin1.txt
- B
iconvの-fと-tはfile名だけを示す。
- C
iconv -f ISO-8859-1 -t UTF-8 latin1.txt
- D
localeを表示すればfileのbyte列も自動で変わる。
正解:C
理由
-fがfrom、-tがtoを示す。
選択肢ごとの説明
- A.
iconv -f UTF-8 -t ISO-8859-1 latin1.txt
変換の向きが逆である。
- B.
iconvの-fと-tはfile名だけを示す。
文字encodingを指定するoptionである。
- C.
iconv -f ISO-8859-1 -t UTF-8 latin1.txt
入力と出力のencodingに合う。
- D.
localeを表示すればfileのbyte列も自動で変わる。
環境の表示はfile変換ではない。