Text file
Microsoft Windows text files: Link the first occurrence of UTF-16. Put "ANSI", "OEM", and "Unicode" encodings (UTF-16 and UTF-8) into separate paragraphs.
| ← Previous revision | Revision as of 06:07, 24 April 2026 | ||
| Line 63: | Line 63: | ||
On Microsoft Windows operating systems, a file is regarded as a text file if the suffix of the name of the file (the "[[filename extension]]") is .txt. However, many other suffixes are used for text files with specific purposes. For example, source code for computer programs is usually kept in text files that have file name suffixes indicating the [[programming language]] in which the source is written. |
On Microsoft Windows operating systems, a file is regarded as a text file if the suffix of the name of the file (the "[[filename extension]]") is .txt. However, many other suffixes are used for text files with specific purposes. For example, source code for computer programs is usually kept in text files that have file name suffixes indicating the [[programming language]] in which the source is written. |
||
Most Microsoft Windows text files use ANSI, OEM, or Unicode ([[UTF-16]] or UTF-8) encoding. |
|||
| ⚫ | |||
| ⚫ | What Microsoft Windows terminology calls "ANSI encodings" are usually single-byte [[ISO/IEC 8859]] encodings (i.e. ANSI in the Microsoft Notepad menus is really "System Code Page", non-Unicode, legacy encoding), except for in locales such as Chinese, Japanese and Korean that require double-byte character sets. ANSI encodings were traditionally used as default system locales within Microsoft Windows, before the transition to Unicode. |
||
| ⚫ | |||
By contrast, OEM encodings, also known as [[DOS code page]]s, were defined by [[IBM]] for use in the original [[IBM PC]] text mode display system. They typically include graphical and [[Box-drawing character|line-drawing characters]] common in DOS applications. |
|||
| ⚫ | "Unicode"-encoded Microsoft Windows text files contain text in UTF-16 Unicode Transformation Format. Such files normally begin with [[byte order mark]] (BOM), which communicates the endianness of the file content. Although UTF-8 does not suffer from endianness problems, many Microsoft Windows programs (i.e. Notepad) prepend the contents of UTF-8-encoded files with BOM,{{cite web |date=Jan 7, 2021 |title=Using Byte Order Marks |url=https://docs.microsoft.com/en-gb/windows/win32/intl/using-byte-order-marks |url-status=live |archive-url=https://web.archive.org/web/20230221224807/https://learn.microsoft.com/en-gb/windows/win32/intl/using-byte-order-marks |archive-date=Feb 21, 2023 |access-date=2022-04-21 |work=Internationalization for Windows Applications |publisher=[[Microsoft]]}} to differentiate UTF-8 encoding from other 8-bit encodings.{{cite web |url=https://www.unicode.org/faq/utf_bom.html#BOM |title=FAQ – UTF-8, UTF-16, UTF-32 & BOM |first=Asmus |last=Freytag |publisher=The Unicode Consortium |date=2015-12-18 |access-date=2016-05-30 |quote=Yes, UTF-8 can contain a BOM. However, it makes ''no'' difference as to the endianness of the byte stream. UTF-8 always has the same byte order. An initial BOM is only used as a signature — an indication that an otherwise unmarked text file is in UTF-8. Note that some recipients of UTF-8 encoded data do not expect a BOM. Where UTF-8 is used ''transparently'' in 8-bit environments, the use of a BOM will interfere with any protocol or file format that expects specific ASCII characters at the beginning, such as the use of "#!" of at the beginning of Unix shell scripts.}} |
||
=== Unix text files === |
=== Unix text files === |
||