Home  >  Q&A  >  body text

java - 如图,a.txt文件开头什么都没有,FileInputstream读取的时候为什么还会出现乱码?

PHPzPHPz2744 days ago638

reply all(5)I'll reply

  • 巴扎黑

    巴扎黑2017-04-18 10:50:36

    If you are windows平台开发,建议使用nodepad++,并选择以UTF-8无BOM格式编码

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:50:36

    may be invisible characters

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 10:50:36

    Try saving the file as utf-8 format

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 10:50:36

    Is there a BOM head

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 10:50:36

    This problem may occur when you use Notepad or the like to save files under Windows. Notepad automatically inserts three invisible bytes 0xEF 0xBB 0xBF, generally called the BOM header.

    You can output these three bytes as hexadecimal or decimal to see if they are these three numbers

    reply
    0
  • Cancelreply