Text Edit Formatting Weirdness

By Joseph Westhouse, 8 July, 2015

Forum
macOS and Mac Apps

I'm encountering a frustrating oddity. If I edit a .txt file in Text Edit, then save it and open it in Windows, it opens up in Notepad or WordPad just fine...however, every line break I created in Text Edit by hitting return simply reads as a "line feed" in Notepad - but the text remains on the same line. This makes trading off documents between my Mac and my Windows work machine something of a frustration, as I then have to go through and re-enter all the line breaks in order to easily navigate the document. Any idea if there's something I can change in TextEdit's preferences (or Notepad's) to fix this behavior?

Options

Comments

By Zack on Tuesday, July 28, 2015 - 22:28

Hello,

What you are seeing is a fairly technical difference between how Windows and Mac store plain text files. There is nothing you can change directly to make this easier, but an excellent a workaround is to use any other format, such as RTF. These can be edited with WordPad, and Will transfer correctly.

The problem you notice is unique to plain text files. I can provide more technical details if you want them, but it's really a lot easier just to use another format.

By Joseph Westhouse on Tuesday, July 28, 2015 - 22:28

Thanks, Zack. Unfortunately one of the main reasons I use plain text files is when I'm scripting for an audiogame I'm helping develop. It's a Windows-only game, so I have to access the files on my Windows computer or VM. But it'd be nice to be able to edit them on my Mac as well without the issue popping up. Looks like that probably won't be an option, though? Bummer.

By splyt on Tuesday, July 28, 2015 - 22:28

The text edit has probably a setting somewhere to allow encoding compatible to other platforms.I will try to check it out and let you know.
Something you can do right now is open the text file in windows in notepad++ (excelent free text editor) and run something to change "\n" to "\r\n" and it should do what you need.
Marlon

By Maldalain on Tuesday, July 28, 2015 - 22:28

Well, I am having some similar other issues with texts edited in TextEdit and then viewed in Notepad, such as the left and right quotes that are shown as O Grave in Notepad.
For your problem, follow this procedure for a temporary solution:
1. Open your document in Notepad.
2. Select all the text then copy the whole content.
3. Open Microsoft Office Word then paste that copied Notepad text.
4. Reselect the whole thing, then copy the selection and paste it in Notepad. You don't have to save the Word document, just copy and paste.
In this case you will get all of your line endings shown in Notepad as Microsoft Word interprets line endings that are not shown in Notepad to actual new lines and by copying and pasting that into your Notepad document you will recover your line endings with Word's interpretation of the new lines.

By splyt on Tuesday, July 28, 2015 - 22:28

For quotes do a vo shift m on text edit and look for smart quotes and disable them. It should work...

By Esther on Tuesday, July 28, 2015 - 22:28

Hi,

I think that most of the issues mentioned in this thread, including the original poster's problem that arises because Windows, Unix, and Macs all use different conventions for end-of-line characters in plain text files, may be most easily solved by downloading the free WordService package from this site:
http://www.devontechnologies.com/download/products.html

You can choose which of the 34 service menu options are enabled under the Services Shortcuts table (under System Preferences > Keyboard > Shortcuts with "Services" selected under the Shortcut categories, and by checking or unchecking the various options prefaced by "WordService:" in the Services shortcuts table; you can also optionally assign your own shortcut to these combinations).

Assuming that I wanted to convert an entire plain text file in TextEdit to the appropriate line endings for reading in Notepad under Windows, and I had the "WordService: Windows Line Endings" option enabled, from TextEdit I would select all text with Command-a, vo m to the menu bar, right arrow to TextEdit, and move down to the Services submenu where I would select "WordService:Windows line endings". If I did this frequently, I would assign a shortcut that did not conflict with any other shortcuts I used, and simply do Command-a to select and then give the shortcut to convert all the line endings in my selection to Windows line endings. There are other options for "Macintosh line endings" and "Unix line endings" that you can also activate.

splyt is correct that you can change your TextEdit preferences so that by default you don't use smart quotes. However, you can also do this all with WordService options to either switch between smart quotes and straight quotes (enable the WordService options for "Smart Quotes" and "Straight Quotes") or by not even bothering to switch off smart quotes, but simply by enabling the "Mac- to Windows-Encoding" and/or "Windows- to Mac-Encoding" WordService options.

So, the way that I would deal with Maldalain's issue of having the smart quotes in TextEdit show up as O grave in Notepad is to leave all of this as smart quotes, but after selecting all with command-a, vo m to the menu bar, right arrow to TextEdit and then navigate down to the services submenu where I would select "WordService: Mac- to Windows Encoding".

Again, these options normally don't have shortcuts assigned to them, so if you have enabled these options and you want to avoid navigating to the Services submenu to change over to Windows character encoding, you'll have to assign your own shortcuts. Also, if you're not used to working with Services menu options, keep in mind that you won't see a list of services displayed unless you select some text for the service to operate on. Also, WordService works for all Cocoa applications on the Mac, so you can use it other places -- for example, to reformat your mail messages by removing extra spaces and lines that arise from your editing, or to fix the titles of accented songs and albums that you imported from your PC collections into iTunes, etc.

Other things WordService can do include replacing tabs with blank spaces, or vice-versa, sort a selected series of lines in ascending or descending order (for example, if you want to alphabetize a series of included entries), trim lines of extra blank spaces, remove quotation marks, capitalize the beginnings of all words in the selection, or force them to be lowercase. So if you have been typing away with your Caplock key on, you can select "WordService: Lowercase" and optionally also use "WordService: Initial Caps of Sentences".

It is also possible to install WordService from the Mac App Store, but I suspect this would be confusing to anyone who does not already know about how to use the Services menu. By downloading from the Devon Technologies web site you'll have access to a PDF document that gives brief help information. The old versions of WordService (that I used back in 2008, before Snow Leopard) used to come with a ReadMe.rtf file so if you do a web search for "WordService ReadMe.rtf" you will likely find one of the old files that described these features a bit more fully (e.g., it will tell you that for Macintosh line endings, it converts all line breaks to 'Carriage Return', for Linux, it uses 'Line Feed', and for Windows it converts line breaks to 'Carriage Return'+'Line Feed'), and the format will be a bit more readable. There were some experimental functions that are no longer present, and some notes about differences for French and German quote treatment that are now handled in the present versions, but you can read the old ReadMe files for the descriptive text.)

I normally test all the functions before posting, but it has been some time since I've tried to use any functions under Windows on a PC, so I'm simply giving a description of how I think this should work now when WordService is applied. The Windows encoding differences should only apply to special characters like right and left quotation marks, and to accented characters.

I'm pretty sure that WordService has been discussed on AppleVis before, but the only reference I can find to it is the old forum discussion about Optimum Reading App or Solution:
http://www.applevis.com/forum/os-x-mac-app-discussion/optimum-reading-app-or-solution

WordService has also been discussed on the MacVisionaries mailing list a number of times in the past. It used to get extensive coverage on various Mac sites when service menu options weren't as frequently used. For example, here's an old Mac OS X hints article from 2005. (Read this in Safari reader -- Command-Shift-R):
http://hints.macworld.com/article.php?story=20050131070150220

HTH. Maybe someone who extensively works with PC text files transferred between Macs and PCs can report back with a better summary of WordService.

Esther