Text files being buggered when saved

Text files being buggered when saved

Author
Discussion

rpguk

Original Poster:

4,492 posts

295 months

Monday 27th October 2003
quotequote all
Sometimes when I save a large (Only talking 5Kb or so) notepad file the second I click on 'save' or 'save as' all the line breaks are removed, as I say, 'sometimes', the problem is intermittent.

This problem is very annoying and if it doesn't get resolved I will no doubt be posting here again soon with a topic such as 'how do you fix a smashed monitor'

The computer is 2.4Ghz, 256mb running XP.

Any help very appreciated (have tried searching the usual places, no luck).

>>> Edited by rpguk on Monday 27th October 00:26

hut49

3,544 posts

273 months

Monday 27th October 2003
quotequote all
Isn't this to do with the WordWrap function being either on or off. If you're importing text into the file and then saving it make sure that the WordWrap function has a tick against it in the Format drop down. This sounds like it is already something that you would have checked - sorry, can't think of any other reason why this would happen intermittently.

rpguk

Original Poster:

4,492 posts

295 months

Tuesday 18th November 2003
quotequote all
Thanks for the reply hut but its not word wrap. Its just that all the carrige returns get removed word wrap on or off.

The problem usually popups up while I'm working on a perl script or HTML file on a server using FTP and editing with notepad (but the problem then also effects wordpad/editpad etc).

It also only effects some files, but not always so for example theres one 4 KB .shtml file at the moment that keeps getting affected all the other files (including other shtml files) I can edit no problem but this one, even if I copy and paste it into another file or anything just won't save while keeping its carrige returns.

It is increadably annoying.

The problem is happening on my windows 98 computer in work as well as my XP machine at home.

Could it maybe some combination of code in the text that forces it to save in binary or something? Or maybe the server is sending some funky commands or something.

I'm at my wits end now. Its the most frustrating problem because I can't work because of it.

Thanks in advance.

Richard.

devdog

165 posts

265 months

Tuesday 18th November 2003
quotequote all
I sometimes have problems with importing files that originate on different operating systems. Some files get saved with a carriage return / linefeed hex(0d0a) but on some systems they only get the CR or the LF (can't rember offhand which). This could be what is happening here and maybe notepad is unable to cope. You could try checking a susupect file with a hex editor.

rpguk

Original Poster:

4,492 posts

295 months

Tuesday 18th November 2003
quotequote all
devdog said:
I sometimes have problems with importing files that originate on different operating systems. Some files get saved with a carriage return / linefeed hex(0d0a) but on some systems they only get the CR or the LF (can't rember offhand which). This could be what is happening here and maybe notepad is unable to cope. You could try checking a susupect file with a hex editor.


Sadly that didn't do the trick either, thanks though.

Heres a screenshot of the file just before I hit the save button (or do a save as)

And heres a screenshot of the file just after I hit the save button (or do a save as)

Mr E

22,316 posts

270 months

Tuesday 18th November 2003
quotequote all
Not a clue mate. But there are zillions of free text editors out there that are significantly better than notepad......

Does one of those do the same thing?

cuzza

2,042 posts

264 months

Tuesday 18th November 2003
quotequote all
Try WordPad, comes as standard with Windows.

rpguk

Original Poster:

4,492 posts

295 months

Tuesday 18th November 2003
quotequote all
the problem also affects wordpad/editpad etc

Thanks for everyone input!

devdog

165 posts

265 months

Tuesday 18th November 2003
quotequote all
if you want to email me a sample file via my profile I'd be glad to have a peek at it.

FunkyGibbon

3,811 posts

275 months

Tuesday 18th November 2003
quotequote all
sounds like the files were originally created (and hosted?) on a unix box. The unix text format uses a ^M character as a line break which notepad will ignore and hence up your page.

Try another editor such as MetaPad (www.liquidninja.com/metapad/) or VIM (www.vim.org/), these (and many others) can deal with unix text format OK.

HTH

>> Edited by FunkyGibbon on Tuesday 18th November 18:31

shadowninja

78,060 posts

293 months

Tuesday 18th November 2003
quotequote all
i recommend textpad. been using it for technical stuff for the last 5 years

Mark.S

473 posts

288 months

Tuesday 18th November 2003
quotequote all
Try change the encoding being used when you 'Save as'.

Bodo

12,425 posts

277 months

Tuesday 18th November 2003
quotequote all
FunkyGibbon said:
sounds like the files were originally created (and hosted?) on a unix box. The unix text format uses a ^M character as a line break which notepad will ignore and hence up your page.

Try another editor such as MetaPad (www.liquidninja.com/metapad/) or VIM (www.vim.org/), these (and many others) can deal with unix text format OK.

HTH

>> Edited by FunkyGibbon on Tuesday 18th November 18:31
If you're right, Funky, rpguk could simply convert them with unix2dos from the command line.

CraigAlsop

1,991 posts

279 months

Tuesday 18th November 2003
quotequote all
However he did say that Wordpad also showed the same problem (it should be able to cope with ^M s just fine)