Hi Jef,

Yes I ran into this as well. If you have a mac text file in your windows 
machine and you want to edit it, then yes, the line breaks are all messed up. 
I'll try to explain what is going on, and then give you the solution.

Each character in a text file is a 1-byte value. In the old days, we called 
them ASCII values. In this character to numbers mapping, an A was 65 in our 
decimal system, or 41 in hex. Just remember that each letter has its associated 
value. These days, there is unicode next to ASCII, bug the idea is the same. 
Each printable character gets a number assigned, so the characters can be 
stored in computer files.

Now, a line break is also a number: 10 in decimal, or 0a in hex. In unix and 
mac text files, if you manually hit enter in a text file, then a byte with the 
decimal value of 10 is inserted as the line break. Windows and dos on the other 
hand, use 2 characters to signal a line break, being 0d 0a, or the 2 bytes 
together, having values of 13 and 10. 13 Is a carriage return, while 10 is a 
line feed. Carriage return comes from the old type writers, where you push the 
carriage back, ready for a new line to be typed. The line feed, stands for 
pulling the handle on the left of the type writer, so that the paper advances 
one line down. See how old unix actually is?

In short: mac uses one byte, 0a, as a new line, and windows uses the carriage 
return and then line feed pair, 0d 0a. So the cause of the problem is, that 
linebreaks look different, in mac files and windows files.

Wordpad in windows is aware of this, but notepad is not. So, while on a mac 
text file inside windows, use the application key to bring up the context menu 
for the file, choose open with, and then choose wordpad. Alternatively, you can 
also first open wordpad and then hit control o to retrieve the text file.

If you use wordpad to open the file, its lines will be nice the way you expect 
them. What I usually do is hit space and then backspace, so that wordpad will 
ask me to save the file once I hit alt f4, and if you save it, even over the 
mac copy, then you will have a nice windows file, where after each linefeed 0a, 
wordpad nicely adds the windows carriage return for you.

So, for each messed up text file from the mac that you are seeing in windows, 
use open with, choose wordpad, save it back, and you're done.

I haven't yet found out how to get rid of the carriage return pair to go the 
other way from windows back to mac. In text edit, I keep seeing carriage return 
linefeed pairs, but text edit is smart enough to handle these nicely.

Hth,
Paul.
On Aug 9, 2013, at 1:36 AM, Jeff Berwick <mailingli...@berwick.name> wrote:

> Hi All,
> 
> I am working with a file that I have created on my Mac and I need to access 
> it on my Windows machine.  The line endings are all messed up though, so that 
> returns are not being honoured.  Does anybody know a quick way to make sure 
> that the file can be edited on both a Mac and Windows machine?
> 
> Thx,
> Jeff
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "MacVisionaries" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to macvisionaries+unsubscr...@googlegroups.com.
> To post to this group, send email to macvisionaries@googlegroups.com.
> Visit this group at http://groups.google.com/group/macvisionaries.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"MacVisionaries" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to macvisionaries+unsubscr...@googlegroups.com.
To post to this group, send email to macvisionaries@googlegroups.com.
Visit this group at http://groups.google.com/group/macvisionaries.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to