Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux iconv-l输出在传递到管道时不同_Linux_Iconv - Fatal编程技术网

Linux iconv-l输出在传递到管道时不同

Linux iconv-l输出在传递到管道时不同,linux,iconv,Linux,Iconv,我发现Linux上的iconv-l输出在通过管道时有所不同 $ iconv -l The following list contain all the coded character sets known. This does not necessarily mean that all combinations of these names can be used for the FROM and TO command line parameters. One coded character

我发现Linux上的
iconv-l
输出在通过管道时有所不同

$ iconv -l
The following list contain all the coded character sets known.  This does
not necessarily mean that all combinations of these names can be used for
the FROM and TO command line parameters.  One coded character set can be
listed with several different names (aliases).

  437, 500, 500V1, 850, 851, 852, 855, 856, 857, 858, 860, 861, 862, 863, 864,
  865, 866, 866NAV, 869, 874, 904, 1026, 1046, 1047, 8859_1, 8859_2, 8859_3,
  8859_4, 8859_5, 8859_6, 8859_7, 8859_8, 8859_9, 10646-1:1993,
...

iconv——版本
给出:

$ iconv --version
iconv (GNU libc) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Ulrich Drepper.

为什么会发生这种情况?这种差异记录在哪里
maniconv
没有提到这种差异。

这是许多程序的典型行为。如用户“rowboat”所述,一些程序通过使用
isatty
功能检查输出是否为终端

此行为的另一个示例是
ls
命令,该命令将在文件夹中为每个文件输出一行,而不是为终端列出它:

$ ls
a.out   b.out   c.out

$ ls | cat
a.out
b.out
c.out

对于
ls
,此行为记录在手册页中,但对于
iconv
似乎没有记录。

中有一个标志
bool human_readable=isatty(fileno(stdout))谢谢你的解释。我试图理解“管道”输出。特别是,每行末尾的“/”是什么意思?我猜这只是别名的分隔符,因为我有类似于
ISO-10646/UTF-8/
的条目。
$ ls
a.out   b.out   c.out

$ ls | cat
a.out
b.out
c.out