Text File
DocumentsA common suffix for unformatted text. It does not identify character encoding; misreading UTF-8, UTF-16 or legacy encodings can cause garbling.
- What it is used for
- Plain-text notes, logs and data
- What the file contains
- Text
All sections, questions and sources
Content reviewed: · Editor:Kai
First: choose for your purpose
TXT stores text but does not identify UTF-8 versus Shift_JIS by its suffix. Saving garbled text can lose data. Separate choosing the opening encoding from converting to another encoding.
Before saving garbled text
| Situation / goal | Next action | What to check |
|---|---|---|
| Japanese characters are garbled | Close without saving and reopen using the original encoding. | Check names, symbols and the final line. |
| Replacement characters were saved | Compare with the original attachment or backup; resaving as UTF-8 cannot restore lost characters. | Determine whether the original already contains replacements. |
| A long line or unexpected wrapping | Distinguish visual wrapping from newline characters. | Avoid inserting real line breaks when wrapping alone is sufficient. |
Source for these steps:Apple · If characters aren’t displayed correctly in TextEdit
Opening steps
Choose your environment or purpose to see its steps.
Menu labels and support vary by app, OS and version. Preserve the original before making changes.
Compare the same text in two encodings
These original practice files contain the same short Japanese text in UTF-8 and UTF-16LE. Try the editor’s encoding selection before changing your own document.
The expected first line is “拡張子ナビの練習ファイルです。” Save a separate copy and reopen it to distinguish decoding from choosing a new output encoding.
The bytes and decoding to identical text are checked; rendering in every editor is not guaranteed.
Source for these steps:Apple · If characters aren’t displayed correctly in TextEdit
Troubleshooting by symptom
- Replacement characters can indicate wrong decoding or prior damage. Obtain an original copy and confirm encoding.
- Distinguish newline conventions from visual wrapping. Use an editor suitable for large logs.
- Long line: enable visual wrapping. Inserting actual line breaks can change configuration/data meaning.
- Saved as RTF: check rich-text mode; save as plain text and verify the visible extension.
- Different symbols on another PC: compare encoding, font, line endings and tab width using a copy.
Convert a TXT encoding to UTF-8
- First decode with the correct original encoding.
- Save a new UTF-8 copy, reopen and verify non-ASCII text.
- Reopen the output and check Japanese characters, symbols, paragraphs and the final line.
Saving incorrectly decoded text can destroy characters. Rich-document-to-TXT conversion loses formatting/images.
Decoding versus encoding conversion
Choosing an opening encoding controls how bytes are decoded. Saving wrongly decoded text as UTF-8 does not restore the original characters.
Once correctly decoded, save a new copy in the recipient’s encoding and reopen it to check names, symbols and the final line.
Source for these steps:Apple · If characters aren’t displayed correctly in TextEdit
What plain text preserves
TXT cannot preserve fonts, colors, images or columns. Apparent tables may be plain characters separated by spaces/tabs.
In configuration or machine-read text, spaces, line breaks and quotes can be significant. Keep readability edits separate from changing operational data.
Related-format differences
| Format / choice | Purpose and preserved information |
|---|---|
| TXT | Text with separately determined encoding/line endings. |
| RTF | Formatted text; converting to TXT removes styling. |
| CSV / MD | Other text-based formats whose delimiters/syntax have additional meaning. |
Handling and security
Viewing text differs from executing its contents. Do not paste untrusted commands into a terminal.
Questions and answers
Is every TXT UTF-8?
No. The suffix does not guarantee encoding.
What if I saved garbled text?
You may need the original or a backup; keep a copy before editing.
Can plain TXT embed a photo?
Plain text has no embedded-image/document-formatting structure; use a document format.
Will saving as UTF-8 fix garbled text?
Decode with the correct encoding first; resaving incorrect characters does not restore them.
Does visual wrapping add line breaks?
Normally it changes display only; distinguish it from inserting newline characters.
Format facts: name, steward and MIME type
- Formal name
- Plain text
- Steward / specification
- No single extension owner; MIME defined by IETF
- MIME type
- text/plain
Primary and official sources
- StandardRFC 2046 — Media Types
Defines text/plain and character-set handling.
IETF · Link checked: - Platform documentationCreate, open and convert documents in TextEdit on Mac
RTF/TXT opening and conversions that remove formatting.
Apple · Link checked: - Platform documentationIf characters aren’t displayed correctly in TextEdit
Selecting the opening encoding when automatic detection fails.
Apple · Link checked: