Hi JavaRanch, a hack coder needs your help. I just finished writing a program to convert certain character strings to other character strings based on the context in a set of text files. The problem is the program that consumes these text files is bombing out while processing them even though Beyond Compare only shows differences that I expect to see.
A little investigation showed me that the original text files were "PC" and my output files are "UNIX" according to Textpad. So I saved the output file chaging the type to "PC" and now all is good.
I figure there is some character that I can't see that is causing Textpad to see it as a UNIX type text file. So, let me tell you a bit about my program...
1. I am writing each line to a StringBuffer like so:
(\r\n should be the newline sequence I need for Windows right?)
2. To write the file I am using:
So, can anyone tell me what I am doing wrong or point me in the direction of a tool to help me figure this out(I'm thinking maybe a hex viewer)? I'm even open for someone to suggest a better way to write a text file if they feel so inclined. Thanks a bunch.
So, this is um... A little embarrassing. Turns out my code program works fine. I originally had used only "\n" for new lines and made the correction to use "\r\n" once I realized that the 2nd program wanted this. However, I forgot to export the executable jar file after compiling the change so I reran the conversion with the exact same code I used the first time. D'oh! So, all is good now.
No more working while having a bad cold for me... Too much wasted time from simple mistakes.