为什么 FileReader 流从文本文件中读取 237、187、191?

Why does the FileReader stream read 237, 187, 191 from a textfile?

我有一个文本文件,里面只有一个字符 'T',我创建了一个读取流以将正在读取的内容输出到控制台,我得到了 239、187、191 和 84,我明白 84 代表 'T',我知道 239、187、191 也代表其他字符,但我的文本文件中没有这些字符,这是怎么回事??

public class Test {

   public static void main(String args[]) throws IOException {  
      FileInputStream in = null;

      try {
         in = new FileInputStream("input.txt");         
         int c;
         while ((c = in.read()) != -1) {
             System.out.println(c);

         }
      }finally {
         if (in != null) {
            in.close();
         }
      }
   }
}

你确定不是239 187 191? (EF BB BF 十六进制)

您正在查看文件的 byte order mark

The byte order mark (BOM) is a Unicode character, U+FEFF BYTE ORDER MARK (BOM), whose appearance as a magic number at the start of a text stream can signal several things to a program reading the text:

The byte order, or endianness, of the text stream;
The fact that the text stream's encoding is Unicode, to a high level of confidence;
Which Unicode encoding the text stream is encoded as.