Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

UNIX vs PC Text file type (Why is my output file considered UNIX by Textpad?) - SOLVED

 
Mark Williams
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark Williams
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Williams wrote:No more working while having a bad cold for me... Too much wasted time from simple mistakes.

You don't need to have a bad cold to make stupid simple mistakes. Trust me, I know
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!