102-500 · Question #135
Which of the following commands can be used to convert text files in one character encoding to another character encoding?
The correct answer is D. iconv. iconv (option D) is the standard Unix/Linux utility for converting text files between character encodings - for example, iconv -f UTF-8 -t ISO-8859-1 input.txt > output.txt converts from UTF-8 to Latin-1. The distractors are wrong for these reasons: cat simply concatenates and…
Question
Options
- Acat
- Bconvert
- Cdd
- Diconv
- Eutf2utf
How the community answered
(28 responses)- B4% (1)
- C4% (1)
- D86% (24)
- E7% (2)
Explanation
iconv (option D) is the standard Unix/Linux utility for converting text files between character encodings - for example, iconv -f UTF-8 -t ISO-8859-1 input.txt > output.txt converts from UTF-8 to Latin-1.
The distractors are wrong for these reasons:
- cat simply concatenates and displays files, with no encoding awareness
- convert is an ImageMagick tool for image format conversion, not text encoding
- dd copies raw bytes and can manipulate block sizes, but has no concept of character encodings
- utf2utf is not a standard utility found in common Linux distributions; it does not exist as a real command
Memory tip: Think of iconv as "international convert" - the i hints at internationalization (i18n), which is exactly what character encoding conversion supports.
Topics
Community Discussion
No community discussion yet for this question.