New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
Switcher Hangout The place for switchers to discuss their new machines, and how to work with OS X. General support can be had here for newbie stuff, like "How do I restart my new iMac?" :)

A way to convert Mac .txt files to Windows .txt files


Post Reply New Thread Subscribe

 
Thread Tools
remain

 
Member Since: Nov 27, 2006
Posts: 440
remain is a jewel in the roughremain is a jewel in the rough
Mac Specs: Power Mac G5 Dual 1.8 GHz

remain is offline
I know there aren't 2 types of TXT files, one for OS X, one for Windows.
I know there's only one type of TXT.

However, there is one little but quite significant difference between plain text files made in the two OSs:

In Windows, line breaks are \r\n
In OS X, they're \n

As a result,
while TXT files created in Windows will display correctly in OS X,
TXT files created in OS X will be missing all the line breaks when opened in Windows.
(Basically, all the text is displayed on 1 line.)


So does anyone know of a way to convert all the \n to \r\n in a TXT?


note:
I am aware of pseudo-solutions, such as using other formats instead (such as DOC),
which display the line breaks correctly in both OSs,
but still, I'd rather be able to use TXT files between the 2 OSs.

Cog 0.07 audio player - cogx.org
AAC, AIFF, APE, FLAC, M4A, MP3, MPC, OGG, SHN, WAV, WV, tracker formats,
VG music formats, cue sheets, M3U & PLS, Growl, Last.fm, Apple Remote
Latest Nightly Build (0.08) (new interface!) - Got ideas? Report bugs?
QUOTE Thanks
eric

 
eric's Avatar
 
Member Since: Nov 04, 2006
Location: twin cities, mn, usa
Posts: 8,801
eric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond repute

eric is offline
that's odd...

i haven't noticed that, but probably because i go xp > os x pretty much all the time rather than the other way.

certainly worth investigating!

Please participate in our Member of the Month polls. Every vote counts! And remember to use the user reputation system!
["Dear Homer, I. O. U. one emergency donut. Signed, Homer." - Note by Homer Simpson]
QUOTE Thanks
remain

 
Member Since: Nov 27, 2006
Posts: 440
remain is a jewel in the roughremain is a jewel in the rough
Mac Specs: Power Mac G5 Dual 1.8 GHz

remain is offline
I think most people don't notice this because by default, TextEdit is in RTF mode.
(I believe line breaks in RTFs are also OK between the 2 OSs; I know for sure it's the case with DOCs.)

I set it to TXT mode because I don't want/need fancy shmancy formatting when I use TextEdit; I just want plain text.

Characters, tabs, line breaks... that's all.

Keeps the file size as small as possible too.

Cog 0.07 audio player - cogx.org
AAC, AIFF, APE, FLAC, M4A, MP3, MPC, OGG, SHN, WAV, WV, tracker formats,
VG music formats, cue sheets, M3U & PLS, Growl, Last.fm, Apple Remote
Latest Nightly Build (0.08) (new interface!) - Got ideas? Report bugs?
QUOTE Thanks
eric

 
eric's Avatar
 
Member Since: Nov 04, 2006
Location: twin cities, mn, usa
Posts: 8,801
eric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond reputeeric has a reputation beyond repute

eric is offline
ah. not that that would be my issue, i use smultron on os x and textpad on windows. pretty sure they're both basic text only. i think i just must not have opened and os x native text docs on my work machine yet...

ooh! maybe i have some on the ext drive in my bag! i'll have to check.

edit: nope. only music and image files.

Please participate in our Member of the Month polls. Every vote counts! And remember to use the user reputation system!
["Dear Homer, I. O. U. one emergency donut. Signed, Homer." - Note by Homer Simpson]
QUOTE Thanks
dtravis7

 
dtravis7's Avatar
 
Member Since: Jan 04, 2005
Location: Modesto, Ca.
Posts: 27,597
dtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond repute
Mac Specs: iMac 2.4 C2D 10.9.4, iMac 2.16 C2d 10.6.8, Macbook2007 10.8.4, Mac Mini 10.8.4, iPhone 3GS Note 8!!

dtravis7 is offline
TextWrangler should work fine. I will give it a try and get back to you. I have my TextEdit set to .txt also and RTF turned off.

Give Textwrangler a try. It's free.
QUOTE Thanks
yogi

 
yogi's Avatar
 
Member Since: Jan 14, 2005
Location: St. Gallen, Switzerland
Posts: 1,973
yogi is a name known to allyogi is a name known to allyogi is a name known to allyogi is a name known to allyogi is a name known to allyogi is a name known to allyogi is a name known to all
Mac Specs: iMac Core i5, iPad, iPhone 4

yogi is offline
TextWrangler ... just supplying the link, since dtravis seems a bit lazy today

If you liked this post, consider using the Reputation System.
QUOTE Thanks
remain

 
Member Since: Nov 27, 2006
Posts: 440
remain is a jewel in the roughremain is a jewel in the rough
Mac Specs: Power Mac G5 Dual 1.8 GHz

remain is offline
TextWrangler seems to do the trick!

Just to make sure I'm not mistaken, I'm basically supposed do this to convert a OS X-made file's line breaks:

-Open in TextWrangler
-Save As
-Click "Options..." at the bottom
-Change "Line Breaks" from "Unix" to "DOS"
-OK
-Save

Is this correct?


BTW,
is there a way to make it such that:

-new files made by TextWrangler are "regular" TXT files (just like those made by TextEdit),
and not the file kind "TextWrangler text file" (and with the TextWrangler document icon)?
-new files made by TextWrangler have the ".txt" extensions by default?


Thanks to all!

Cog 0.07 audio player - cogx.org
AAC, AIFF, APE, FLAC, M4A, MP3, MPC, OGG, SHN, WAV, WV, tracker formats,
VG music formats, cue sheets, M3U & PLS, Growl, Last.fm, Apple Remote
Latest Nightly Build (0.08) (new interface!) - Got ideas? Report bugs?
QUOTE Thanks
dtravis7

 
dtravis7's Avatar
 
Member Since: Jan 04, 2005
Location: Modesto, Ca.
Posts: 27,597
dtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond repute
Mac Specs: iMac 2.4 C2D 10.9.4, iMac 2.16 C2d 10.6.8, Macbook2007 10.8.4, Mac Mini 10.8.4, iPhone 3GS Note 8!!

dtravis7 is offline
Quote:
Originally Posted by yogi View Post
TextWrangler ... just supplying the link, since dtravis seems a bit lazy today


dtravis7 was waiting to be sure it would work before saying more. Been so busy I have not even had the time to test it. Glad it works for you.
QUOTE Thanks
walkerj

 
walkerj's Avatar
 
Member Since: Feb 13, 2005
Location: New Orleans, LA, USA
Posts: 1,186
walkerj is just really nicewalkerj is just really nicewalkerj is just really nicewalkerj is just really nice
Mac Specs: 13" Macbook Pro 2.26Ghz Unibody 4G RAM 160G HDD Superdrive

walkerj is offline
This is also why I use command line utilities for both OS's, and this is something that goes back to the early days of all the UNIX's and the DOS world.

You'll note that if you use vi on a text file created by a Windows notepad, for example, will show ^M characters at each newline, while text files created by Mac OS X will look all goofy using windows notepad. Oddly enough, if you edit a text file created by Mac OS X with the "DOS" command line 'edit' command under Windows and just save it, it'll convert the newlines to what Windows expects with the rest of the Windows text editors.

Over on the Mac side, TextEdit generally seems to handle text files properly regardless of where they are created, but vi will show those 'crlf' characters as a ^M, which is not a big deal, but annoying. The vi command line way I deal with this is:

:%s/'control-v''control-m'//

and they will be be converted to 'cr' (carriage return, not carriage return-linefeed) and when you save the file it'll be all well in the UNIX world.

This is probably all confusing to non-UNIX geeks, but this is something I've had to deal with for the entire 20+ years I've been dealing with text between DOS and UNIX. It's real fun when you have thousands of text scripts that have to be ported across OSes and have to figure out what program can best be used to batch convert them all.
QUOTE Thanks
technologist

 
Member Since: Mar 30, 2004
Location: USA
Posts: 4,744
technologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond repute
Mac Specs: 12" Apple PowerBook G4 (1.5GHz)

technologist is offline
Quote:
Originally Posted by remain View Post
...
BTW,
is there a way to make it such that:

-new files made by TextWrangler are "regular" TXT files (just like those made by TextEdit),
and not the file kind "TextWrangler text file" (and with the TextWrangler document icon)?
They are plain ASCII text files, just like those from TextEdit. However, they have a creator code that assign them to open in TextWrangler, which means they carry a TextWrangler icon. Other files on your system may have a TextEdit creator code, so they will sow a TextEdit icon and open in TextEdit by default.

In the same vein, you can have, for example, Photoshop JPEGS, Preview JPEGs, and GraphicConverter JPEGs, even though they are all the same format. Macs can assign the file types to different applications on a file-by-file basis, unlike PCs. You can, if you like, override this by using the "always open with" option; see the "How do I set a default app" link in my sig.
Quote:
-new files made by TextWrangler have the ".txt" extensions by default?
I don't believe so, but I'm sure that, if you send BareBones Software (the company) some feedback, they'll make this a preferences option in the future.
QUOTE Thanks

Post Reply New Thread Subscribe


« Real Time Stock Ticker Wont Work on any browser | MBP camera »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
drag files from mac to windows on bootcamp polskie Running Windows (or anything else) on your Mac 5 05-27-2009 07:57 AM
Running Windows on a Mac: A Switcher's Guide UncSki1218 Running Windows (or anything else) on your Mac 80 06-10-2008 10:34 PM
iPod for Windows and Mac? MacAddikt iPod Hardware and Accessories 12 03-31-2007 09:33 AM
Parallels - can't copy from Windows XP virtual machine and paste to Mac Pro ithacalaw Running Windows (or anything else) on your Mac 5 10-22-2006 09:14 PM
Mac Users Get More ISP Choices schweb Apple Rumors and Reports 1 03-06-2003 10:57 AM

All times are GMT -4. The time now is 02:34 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?