In LINUX, when modifying the file character set, we need to modify the file character set to solve Garbled text or other problems. In linux, the operating system provides us with the ICONV command. Let's take a look at the specific usage of this command. [Plain] [root @ oadata ~] # Iconv -- help usage: iconv [Options...] [file...] converts the encoding of the given file. Input/output format specifications:-f, -- from-code = Name original text encoding-t, -- to-code = Name output encoding information:-l, -- list lists all known character set output control:-c ignores invalid characters-o from the output, -- output = FILE output FILE-s, -- silent close warning -- verbose prints progress information -?, -- Help provides the system's help list -- usage provides brief usage information-V, -- version prints the program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. for bug reporting instructions, please see :. to view the character information of a file, linux also provides the file function: [plain] [root @ oadata ~] # File -- help Usage: file [OPTION]... [FILE]... determine file type of FILEs. -m, -- magic-file LIST use LIST as a colon-separated list of magic number files-z, -- uncompress try to look inside compressed files-B, -- brief do not prepend filenames to output lines-c, -- checking-printout print the parsed form of the magic file, use in conjunction with-m to debug a new magic file before installing it -F, -- files-from FILE read the filenames to be examined from FILE-F, -- separator string use string as separator instead of ':'-I, -- mime output mime type strings-k, -- keep-going don't stop at the first match-L, -- dereference causes symlinks to be followed-n, -- no-buffer do not buffer output-N, -- no-pad do not pad output-p, -- preserve-date preserve access times on files-r, -- raw don't tran Slate unprintable chars to \ ooo-s, -- special-files treat special (block/char devices) files as ordinary ones -- help display this help and exit -- version output version information and exit [root @ oadata ~] # File-I. log. log: text/plain; charset = us-ascii single file Character Set conversion: [plain] [oracle @ oadata dir1] $ ls-l total 4-rw-r -- 1 oracle oinstall 22 10-12 13:14 utf8.txt [oracle @ oadata dir1] $ file- I utf8.txt utf8.txt: text/plain; charset = UTF-8 [oracle @ oadata dir1] $ iconv-f UTF-8-t gbk-o gbk.txt utf8.txt [oracle @ oadata dir1] $ ls-l total 8-rw-r -- 1 oracle oinstall 15 10-12 13:43 gbk.txt-rw-r -- 1 oracle oinstall 22 10-12 13:14 utf8.txt [oracle @ oadata dir1] $ file-I gbk.txt: text/plain; charset = iso-8859-1 Character Set conversion for files under a directory: [plain] for I in 'Find. /-name *. php'; do echo $ I; iconv-c-f gb18030-t utf8 $ I-o/tmp/iconv. tmp; mv/tmp/iconv. tmp $ I; done