Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to import a text file that has a non-standard encoding

Status
Not open for further replies.

yahoo182

Programmer
Jul 5, 2005
70
CA
Hi there,
I have written a applicaiton that reads in a text file and then parses each line to store a record in MySQL.
I'm having problem with only this one file where when I open with notepad, there is no new line and instead the line breaker character is replaced with a number like 105788, 105704, 105708, and so on (its not the same number for each line)


However, when I open this same file with wordpad, the new line shows correctly. I was wondering if anyone can point out some suggestion as to how I can effectively import this file. Currently, my application is dependent on the fact that each field is seperated by a new line.

Thanks :)
 
Your problem is that Notepad does not recognise a single '\n' as a line terminator; it expects '\r\n'. So instead of a line break, what you will see is a box character.
 
/I have written a applicaiton that reads /
If it is a fixed length text you can try coding the length in your app.
 
Hi there,
Thanks for the reply. Another way around this I found was to open with wordpad and save as text DOS format.
The original file was generated in a Linux/Unix environment it seems and thats why it had a different newline format.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top