Plain text files have nonsense inserted

I'm using High Sierra on an iMac. When I open old Plain Text files (from 2019, say) with TextEdit, they are garbled with a lot of code-like inserts. They start with stuff like this –


{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360

{\fonttbl\f0\fswiss\fcharset0 Helvetica;}

{\colortbl;\red255\green255\blue255;}

\paperw11900\paperh16840\margl1440\margr1440\vieww10500\viewh9600\viewkind0

\deftab1120

\pard\pardeftab1120\ql\qnatural\pardirnatural


Throughout the text, accented letters, apostrophes, returns, spacing, etc. are also gobbledy-gook.

What's going on, & how can I fix it?


iMac, macOS 10.13

Posted on Jun 16, 2025 10:57 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 16, 2025 03:41 PM

I think you're misunderstanding the problem.. The file *is* RTF. That's what RTF looks like 'under the hood'


The mistake is that TextEdit thinks it's a plain text file, not a rich text file.


Does the file have a .rtf extension or a .txt? Does it have any extension?

If the file is that old it may predate filename extensions and TextEdit is incorrectly assuming it's plain text, and is showing you the raw file contents. If that's the case, simply renaming the file to have a .rtf extension should solve the problem.

Similar questions

5 replies
Question marked as Top-ranking reply

Jun 16, 2025 03:41 PM in response to nielshutch

I think you're misunderstanding the problem.. The file *is* RTF. That's what RTF looks like 'under the hood'


The mistake is that TextEdit thinks it's a plain text file, not a rich text file.


Does the file have a .rtf extension or a .txt? Does it have any extension?

If the file is that old it may predate filename extensions and TextEdit is incorrectly assuming it's plain text, and is showing you the raw file contents. If that's the case, simply renaming the file to have a .rtf extension should solve the problem.

Jun 16, 2025 10:44 PM in response to Camelot

Thanks, Camelot!

It turns out that many .rtf are showing up incorrectly as .txt – they don't even have that extra dot on the icon in a Finder window. Nor are they correct in the Info pane, under "Name & extension".

My mistake was thinking that converting an open file to .rtf with Shift-Command-T (under Format in the Menu bar) would work. It did not; it simply saved the file as .rtf with all the coding still showing as text. (Painstaking correction then had to be done by hand for each file.)


A solution (of sorts) has been arrived at, which I will outline for other dummies...

• Wonky files are easy to spot. The unwanted code on a file shows in the Preview pane of a Finder window.

• Changing file type has to be done by typing the proper extension onto a file name, either in a Finder window or on the Info pane. (A warning window comes up: "Are you sure...?", but that's OK. It can be turned off in Finder preferences > Advanced.)

• The change seems to work whether the file is open or not, but will only appear after the file is closed and reopened. Whether the extension is hidden or not does not seem to matter; the little dot will still appear on the file's icon.


So I'm blaming TextEdit for incorrectly identifying the files. Two things –

  1. Should I copy-paste TextEdit from my laptop to my iMac? Is that advisable, or even possible?
  2. Under "Open with:" in the Info pane, should I press "Change All...", or might this convert legitimate text files to rich text?

Otherwise I'll plod on...the problem is now manageable.

Jun 17, 2025 11:49 AM in response to nielshutch

  1. > Should I copy-paste TextEdit from my laptop to my iMac? Is that advisable, or even possible?


It's an option, but seems like a more cumbersome way of doing it to me.

Clipboard synching (aka 'Universal Clipboard') requires that both devices are linked to the same Apple Account and that Handoff is enabled in System Settings. Once you do that you can copy anything to the clipboard on one machine and paste it on the other.


2. Under "Open with:" in the Info pane, should I press "Change All...", or might this convert legitimate text files to rich text? Otherwise I'll plod on...the problem is now manageable.


The 'Change All...' option is not smart in any way, but it also won't help here. All it will do is tell MacOS to use TextEdit as the default application for files with this filename extension (e.g. "open all '.txt' files with TextEdit.app"). Since the files have the wrong extension it's not going to help. The key is that you need to change the filename extension on the affected files so that TextEdit knows how to interpret the file contents.

Jun 16, 2025 01:53 PM in response to Niel

Went to Open and Save (it's under Preferences in my TextEdit menu) & the box for RTF code wasn't ticked.

Nor does changing the extension name do anything.

Tried a few things – saving a copy in a different format (UTF-16, etc.); opening file with the option to ignore rich text commands, etc. Still nothing.

The only thing I changed in Preferences is the default font for .rtf files to Helvetica 12. Changing it back doesn't help.


Oddly, some even older plain text files seem fine, but many do not. So I'm guessing a change in TextEdit versions would not be the cause (e.g. from 1.6 for Snow Leopard to my current 1.13). I'm suspicious of the word "cocoa" appearing in the added code, but who knows?


It is as if some pesky app. has tried to be 'helpful' but has only partly succeeded, and it is a right pain unscrambling the mess!


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.

Plain text files have nonsense inserted

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