• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic