I have two .txt files from which I read data.

File number 1:

7879 lab_1.docx 18 

File number 2:

 6431 

The idea is that the id files already processed are written to the second file.
It is necessary to check for the presence of id and do something.

 for (; scannerTmp.hasNext(); ) { id_found = false; line = scannerTmp.nextLine(); mName = scannerTmp.nextLine(); mPages = scannerTmp.nextLine(); while (scannerId.hasNext()) { line2 = scannerId.nextLine(); System.out.println(line.toString() + "+" + line2.toString()); if (line.toString().equals(line2.toString())) { id_found = true; break; } 

This is what happens on the output:

 п»ї7879+6431 

Where do these incomprehensible signs come from?

1 answer 1

This is a BOM UTF-8 displayed in cp-1251 encoding.
Save files without BOM (this option is in any normal text editor).

  • Thank you, it all worked - Roma Heshten