TextEdit to Notepad

Discussion in 'macOS' started by Jongewehr, Jun 21, 2009.

  1. Jongewehr macrumors 6502

    Joined:
    May 1, 2009
    #1
    hey guys, im savein some .txt files on the mac an openin them on a pc, an they open weird on the pc, without the line breaks

    is there a settin in texteditor so windows can see it like i see it on the mac?
     
  2. Wowzera macrumors 6502a

    Joined:
    Oct 14, 2008
    Location:
    Brazil
    #2
    Notepad is a bad program. Every time it see the character of line break created on UNIX it won't recognize it and create the formal line break of the Windows and of the UNIX, messing around all your text. Try using another text editor.
     
  3. old-wiz macrumors G3

    Joined:
    Mar 26, 2008
    Location:
    West Suburban Boston Ma
    #3
    There has always been an issue with "new line" some systems defined it as just 'c/r' and other defined it as 'c/r lf' It always annoyed me when I had to switch around between different systems.
     
  4. Jongewehr thread starter macrumors 6502

    Joined:
    May 1, 2009
    #4
    i can open windows .txt fine , but not the other way,, can i fix this?
     
  5. Eraserhead macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #5
    Yeah, by changing the line endings to Windows formatted.

    Alternatively you could just use a decent text editor on Windows like Notepad++.
     
  6. Jongewehr thread starter macrumors 6502

    Joined:
    May 1, 2009
    #6
    could u explain how?
     
  7. Eraserhead macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #7
    Xcode, TextWrangler and other advanced text editors can change the line endings...
     
  8. old-wiz macrumors G3

    Joined:
    Mar 26, 2008
    Location:
    West Suburban Boston Ma
    #8
    More example of the limited functionality of notepad. Other editors can do it easily.
     
  9. Jongewehr thread starter macrumors 6502

    Joined:
    May 1, 2009
    #9
    Text Editor has all those options, u think u could just change the break to windows format.. oh well
     
  10. Jongewehr thread starter macrumors 6502

    Joined:
    May 1, 2009
    #10
    why cant u save how osx saves its?
     
  11. old-wiz macrumors G3

    Joined:
    Mar 26, 2008
    Location:
    West Suburban Boston Ma
    #11
    probably because Microsoft didn't want to bother. Sometimes there seems to be no real reason for options.
     
  12. Jongewehr thread starter macrumors 6502

    Joined:
    May 1, 2009
    #12
    i ment to say , why cant osx save it the windows way
     
  13. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #13
    Because it's not Windows. Linux does it a different way from Windows and Mac. When on a Mac, it only makes sense a program would save it in a Mac format. I use text editors that let me choose line endings and encoding types (BBEdit). TextEdit and Notepad are just too basic for me as a developer.
     
  14. Wowzera macrumors 6502a

    Joined:
    Oct 14, 2008
    Location:
    Brazil
    #14
    I've no problems opening Line breaks made by Linux/Mac on Linux/Mac. The issue is notepad by windows.

    @OP
    Choose another text editor for windows, do not use that crap called notepad.
    Try using notepad++, as suggested before on this thread.
     
  15. Guiyon macrumors 6502a

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #15
    For Mac OS 9 and below, this is true. For Mac OS X and newer, however, it is not; like most other Unix-like systems it uses the '\n' character as the newline. Microsoft apparently couldn't decide which one was better and implemented both :/

    Mac OS 9: \CR (\r)
    Mac OS X, Linux, *BSD, etc: \LF (\n)
    Windows: \CR\LF (\r\n)


    WordPad can read both \LF and \CR\LF with no problems, it's only Notepad that panics.
     
  16. Eraserhead macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #16
    Because notepad is the only text reader on the planet that doesn't just handle this transparently.
     
  17. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #17
    Ah, that's right. Thanks for the clarification. I always set my editors to Linux so I never really thought about it.
     
  18. keithOrbit macrumors member

    Joined:
    Apr 22, 2008
    #18
    my way is: save the xxx.rtf format, and open it used microsoft word. it well.
     
  19. pilotError macrumors 68020

    pilotError

    Joined:
    Apr 12, 2006
    Location:
    Long Island
    #19
    Just use wordpad, it will use the Mac end of lines just fine.
     
  20. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #20
    Windows inherited this from DOS, which followed the old teletype regime where an operator needed to return the carriage to position 1 (CR) then advance the roller one line (Line Feed). If you've got an old DOS computer around hit CTRL - G. It'll beep because that's the bell code teletype operators used to use to wake up people on the other end.

    One of the best Mac text editors to handle the Mac -> PC transition would be Tex-Edit by Trans Tech Software (not TextEdit from Apple).

    Another alternative would be to use AppleScript:

    Code:
    tell application "TextEdit"
    	set output to ""
    	repeat with n from 1 to number of paragraphs of document 1
    		set output to output & (paragraph n of document 1) & (ASCII character 13) & (ASCII character 14)
    	end repeat
    	
    	make new document with properties {text:output}
    	
    end tell
    mt
     
  21. alphabeta macrumors newbie

    Joined:
    Jul 8, 2009
    #21
    What if I'm creating text files to be seen by others? ... who might likely be on a PC and might double-click to open?

    So I want a solution that works for that case.

    Should I save the files as .rtf, will that work? Or would a more reliable solution be to make .html pages of them? Or ... ?
     
  22. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #22
    Please read over the thread more closely as it already answers your questions. If you feel it doesn't, you may want to explain what further explanation you're needing.
     
  23. alphabeta macrumors newbie

    Joined:
    Jul 8, 2009
    #23
    For now, I want to use TextEdit and no scripting and achieve the desired effect (line breaks show as entered) on various (Windows and other) systems.

    The only solutions to this I know are (1) to use .rtf or (2) to make .html files and put in my <br>s where wanted. So my question is will TextEdit's .rtf be reliable enough for double-clicking over various (Windows and other) systems? or would I best make the files .html? Or am I still missing something in the thread?

    (In the future, I will probably try BBEdit or one of the other text editors, preferably just one of them ... )
     
  24. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #24
    Kind of depends on what kind of document you're writing, plain text or text that allows styling (e.g., bold, underline, italics, etc.). For plain text, if you save the file with a .txt extension, it'll open with Notepad on Windows. If the file was created with TextEdit, the line endings won't be right. In the plain text case, I would recommend TextWrangler (BBEdit's free cousin) as it can set the line ending style for Windows.

    If you're doing any type of styling you can use TextEdit without issues (more or less). You can either choose RTF or you can use the DOC extension, which will open in MS Word by default for most Windows users. TextEdit's RTF and DOC compatibility should be pretty good with Windows.
     
  25. Signal-11 macrumors 65816

    Signal-11

    Joined:
    Mar 23, 2008
    Location:
    2nd Star to the Right
    #25
    TextWrangler is free and is likely more than powerful enough for your needs.
     

Share This Page