0

I have written Java code that prepares a .txt file with tab delimited data in it. This file is then to be supplied to another software to parse the data. However, this other software is unable to load the data.

But when I copied the data from the .txt file to Excel and then copied from Excel into a new .txt file, the software was then able to read this new .txt file. I am completely lost as to what is the difference between the initial .txt file generated by my code and the new .txt file after pasting from Excel.

khelwood
  • 55,782
  • 14
  • 81
  • 108
B Basak
  • 113
  • 2
  • 8
  • Did you run a file comparison on both files? Could there be a difference in the line breaks, e.g. `\n` vs. `\r\n`? – Thomas Nov 22 '22 at 08:35
  • Potential culprit is [the new line character](https://stackoverflow.com/questions/1552749/difference-between-cr-lf-lf-and-cr-line-break-types) (LF vs CRLF)... – assylias Nov 22 '22 at 08:37
  • @Thomas I did use multiple online tools for comparison between the two files and all of them found both the files identical. I also used notepad++ "Find All in Current Document" functionality to get a count of the \n and \t characters in both files and the count is identical in both. However, I just now checked the \r\n in both the files and I can see that the text file in which data was copied over from Excel has \r\n at the end of each line but the file generated by my code doesn't. Hopefully, fixing this will resolve my issue. Thank you so much! – B Basak Nov 22 '22 at 11:45

0 Answers0