Why cant textEdit save as .txt files?

It does not save to plain .txt. Why?

ibook 12 G4 1.2 ghz (512MB RAM) (UPGRADED 5/25/05 FROM PERFORMA 6360), Mac OS X (10.4.7), Also own Zire 72, Compaq Armada 1700, HP Jornada 720

Posted on Oct 17, 2006 7:15 PM

Reply
9 replies

Oct 20, 2006 1:34 PM in response to John Wolf

I hope someone call help me.

I've got a text file on my MAC which is a list of email addresses, 1 per line, it displays fine but when I try and transfer to my PC with XP or email to a friend the file wont display the same, when opened the email addresses are on one long list and not one per line as originally saved, I have tried to save in every format and have made sure the file ends .txt but I just can't get it to work, my understanding was the .txt was universal?

Oct 20, 2006 2:13 PM in response to PaulOB4

The text itself may be universal but the end-of-line characters are not. TextEdit on the Mac uses a line feed character (LF = 0x0A) as it's end of line character... the standard on Unix systems. Windows uses a combination of both a carriage return and a line feed (CRLF = 0x0D0A). It's the lack of the carriage returns that's causing the Windows machine to treat your text file as a single line. (Note that pre-OS X Mac apps used just a carriage return (CR = 0x0D) as their end-of-line character... so there are actually three variations you might run across).

Some editors can deal with all three types of end of line characters and will also let you convert a file from one type to another. I'm not sure if TextEdit can do this. I believe the editor built into Xcode can though and probably BBEdit or TextWrangler. I'm sure there are probably some Windows editors that will also deal with different line endings.

Steve

Oct 20, 2006 2:49 PM in response to Malcolm Rayfield

Here's a command you can issue in Terminal to convert a Mac text file to a Windows text file:

awk '{print $0 "\r"}' OriginalFile.txt > ConvertedFile.txt

The above command will create a new "ConvertedFile.txt" file from the contents of "OriginalFile.txt" but change all the line feeds to carriage return/line feed pairs.

Do not try to use this to convert a file "in place" (ie don't try to save the output back into the original file) or you will lose your data. In other words, DO NOT do this:

awk '{print $0 "\r"}' OriginalFile.txt > OriginalFile.txt

Steve

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Why cant textEdit save as .txt files?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.