Share to: share facebook share twitter share wa share telegram print page

Text file

Text file
Filename extension
.txt
Internet media type
text/plain
Type codeTEXT
Uniform Type Identifier (UTI)public.plain-text
UTI conformationpublic.text
Type of formatDocument file format, Generic container format

A text file (sometimes spelled textfile; an old alternative name is flatfile) is a kind of computer file that is structured as a sequence of lines of electronic text. A text file exists stored as data within a computer file system.

In operating systems such as CP/M, where the operating system does not keep track of the file size in bytes, the end of a text file is denoted by placing one or more special characters, known as an end-of-file (EOF) marker, as padding after the last line in a text file. In modern operating systems such as DOS, Microsoft Windows and Unix-like systems, text files do not contain any special EOF character, because file systems on those operating systems keep track of the file size in bytes.

Some operating systems, such as Multics, Unix-like systems, CP/M, DOS, the classic Mac OS, and Windows, store text files as a sequence of bytes, with an end-of-line delimiter at the end of each line. Other operating systems, such as OpenVMS and OS/360 and its successors, have record-oriented filesystems, in which text files are stored as a sequence either of fixed-length records or of variable-length records with a record-length value in the record header.

"Text file" refers to a type of container, while plain text refers to a type of content.

At a generic level of description, there are two kinds of computer files: text files and binary files.[1]

Data storage

A stylized iconic depiction of a CSV-formatted text file

Because of their simplicity, text files are commonly used for storage of information. They avoid some of the problems encountered with other file formats, such as endianness, padding bytes, or differences in the number of bytes in a machine word. Further, when data corruption occurs in a text file, it is often easier to recover and continue processing the remaining contents. A disadvantage of text files is that they usually have a low entropy, meaning that the information occupies more storage than is strictly necessary.

A simple text file may need no additional metadata (other than knowledge of its character set) to assist the reader in interpretation. A text file may contain no data at all, which is a case of zero-byte file.

Encoding

The ASCII character set is the most common compatible subset of character sets for English-language text files, and is generally assumed to be the default file format in many situations. It covers American English, but for the British pound sign, the euro sign, or characters used outside English, a richer character set must be used. In many systems, this is chosen based on the default locale setting on the computer it is read on. Prior to UTF-8, this was traditionally single-byte encodings (such as ISO-8859-1 through ISO-8859-16) for European languages and wide character encodings for Asian languages.

Because encodings necessarily have only a limited repertoire of characters, often very small, many are only usable to represent text in a limited subset of human languages. Unicode is an attempt to create a common standard for representing all known languages, and most known character sets are subsets of the very large Unicode character set. Although there are multiple character encodings available for Unicode, the most common is UTF-8, which has the advantage of being backwards-compatible with ASCII; that is, every ASCII text file is also a UTF-8 text file with identical meaning. UTF-8 also has the advantage that it is easily auto-detectable. Thus, a common operating mode of UTF-8 capable software, when opening files of unknown encoding, is to try UTF-8 first and fall back to a locale dependent legacy encoding when it definitely is not UTF-8.

Formats

On most operating systems, the name text file refers to a file format that allows only plain text content with very little formatting (e.g., no bold or italic types). Such files can be viewed and edited on text terminals or in simple text editors. Text files usually have the MIME type text/plain, usually with additional information indicating an encoding.

Microsoft Windows text files

DOS and Microsoft Windows use a common text file format, with each line of text separated by a two-character combination: carriage return (CR) and line feed (LF). It is common for the last line of text not to be terminated with a CR-LF marker, and many text editors (including Notepad) do not automatically insert one on the last line.

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, Unicode 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 pages, were defined by IBM for use in the original IBM PC text mode display system. They typically include graphical and 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,[2] to differentiate UTF-8 encoding from other 8-bit encodings.[3]

Unix text files

On Unix-like operating systems, text files format is precisely described: POSIX defines a text file as a file that contains characters organized into zero or more lines,[4] where lines are sequences of zero or more non-newline characters plus a terminating newline character,[5] normally LF.

Additionally, POSIX defines a printable file as a text file whose characters are printable or space or backspace according to regional rules. This excludes most control characters, which are not printable.[6]

Apple Macintosh text files

Prior to the advent of macOS, the classic Mac OS system regarded the content of a file (the data fork) to be a text file when its resource fork indicated that the type of the file was "TEXT".[7] Lines of classic Mac OS text files are terminated with CR characters.[8]

Being a Unix-like system, macOS uses Unix format for text files.[8] Uniform Type Identifier (UTI) used for text files in macOS is "public.plain-text"; additional, more specific UTIs are: "public.utf8-plain-text" for utf-8-encoded text, "public.utf16-external-plain-text" and "public.utf16-plain-text" for utf-16-encoded text and "com.apple.traditional-mac-plain-text" for classic Mac OS text files.[7]

Rendering

When opened by a text editor, human-readable content is presented to the user. This often consists of the file's plain text visible to the user. Depending on the application, control codes may be rendered either as literal instructions acted upon by the editor, or as visible escape characters that can be edited as plain text. Though there may be plain text in a text file, control characters within the file (especially the end-of-file character) can render the plain text unseen by a particular method.

See also

Notes and references

  1. ^ Lewis, John (2006). Computer Science Illuminated. Jones and Bartlett. ISBN 0-7637-4149-3.
  2. ^ "Using Byte Order Marks". Internationalization for Windows Applications. Microsoft. Jan 7, 2021. Archived from the original on Feb 21, 2023. Retrieved 2022-04-21.
  3. ^ Freytag, Asmus (2015-12-18). "FAQ – UTF-8, UTF-16, UTF-32 & BOM". The Unicode Consortium. Retrieved 2016-05-30. 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.
  4. ^ "3.403 Text File". IEEE Std 1003.1, 2017 Edition. IEEE Computer Society. Retrieved 2019-03-01.
  5. ^ "3.206 Line". IEEE Std 1003.1, 2013 Edition. IEEE Computer Society. Retrieved 2015-12-15.
  6. ^ "3.284 Printable File". IEEE Std 1003.1, 2013 Edition. IEEE Computer Society. Retrieved 2015-12-15.
  7. ^ a b "System-Declared Uniform Type Identifiers". Guides and Sample Code. Apple Inc. 2009-11-17. Retrieved 2016-09-12.
  8. ^ a b "Designing Scripts for Cross-Platform Deployment". Mac Developer Library. Apple Inc. 2014-03-10. Retrieved 2016-09-12.

Read other articles:

Hereditary Grand Duchess of Oldenburg Princess ElisabethHereditary Grand Duchess of OldenburgBorn(1857-02-08)8 February 1857Potsdam, Kingdom of PrussiaDied28 August 1895(1895-08-28) (aged 38)Fulda, Prussia, German EmpireBurialDucal (Herzogliches) Mausoleum, Gertrudenfriedhof, OldenburgSpouse Frederick Augustus, Hereditary Grand Duke of Oldenburg ​ ​(m. 1878)​IssueSophia Charlotte, Princess Eitel Friedrich of PrussiaDuchess MargaretHouseHohenzollernFathe...

Manushi ChhillarChhillar pada tahun 2018 selama kunjungannya ke Brasil sebagai Miss World yang menjabat.Lahir14 Mei 1997 (umur 26)Haryana, IndiaPendidikanSt. Thomas' SchoolBhagat Phool Singh Medical CollegePekerjaanRatu kecantikanmodelTinggi1,75 m (5 ft 9 in)Pemenang kontes kecantikanGelarFemina Miss India 2017Miss World 2017Warna rambutCoklatWarna mataCoklatKompetisiutamaFemina Miss India 2017(Pemenang)Miss World 2017(Pemenang) Manushi Chhillar (lahir 14 Mei 1997) adalah ...

Lasse Virén Lasse Virén c. 1974 Informations Disciplines 5 000 m, 10 000 m et marathon Nationalité Finlande Naissance 22 juillet 1949 Lieu de naissance Myrskylä Taille 1,80 m Poids 60 kg Distinctions Élu au Temple de la renommée de l'IAAF en 2014 Palmarès Médailles obtenues Jeux olympiques 4 0 0 Championnats d'Europe 0 0 1 modifier  Lasse Virén (né le 22 juillet 1949 à Myrskylä) est un coureur de fond finlandais. Quatre fois médaillé d'or aux Jeux olympiques, auteur d'un «...

通远军,中国宋朝時規劃的军。 宋神宗熙宁五年(1072年),以秦州古渭砦为通远军(今甘肃省陇西县)。元丰四年(1081年),以兰州西使城为定西城。元丰五年(1082年),改定西城为通远军,以汝遮堡为定西城(今甘肃省定西市),属通远军。宋徽宗崇宁三年(1104年),升为巩州。 查论编北宋行政区划 路京畿路府开封府(東京)京東東路府济南府(齐州)州 青州 密...

Der Titel dieses Artikels ist mehrdeutig. Zu Linienbussen ähnlicher Größe siehe Minibus Dieser Artikel oder nachfolgende Abschnitt ist nicht hinreichend mit Belegen (beispielsweise Einzelnachweisen) ausgestattet. Angaben ohne ausreichenden Beleg könnten demnächst entfernt werden. Bitte hilf Wikipedia, indem du die Angaben recherchierst und gute Belege einfügst. VW T1 Ford Transit III Barkas B 1000 Opel Vivaro Mercedes-Benz V-Klasse Kleinbus ist die Bezeichnung für einen Kleintransporte...

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Fragile Kygo and Labrinth song – news · newspapers · books · scholar · JSTOR (April 2016) (Learn how and when to remove this template message) 2016 promotional single by Kygo and LabrinthFragilePromotional single by Kygo and Labrinthfrom the album Cloud Ni...

Escudo de Salta InformaciónEntidad Escudo de ciudadPropietario Ciudad y municipio de Salta,  ArgentinaFecha de adopción 1934Usos · Organismos dependientes de la Municipalidad de Salta · EsculturasDescripciónBlasón Presenta sobre campo único dividido por un río, dos cerros en el horizonte y tres árboles en la diestra. Cuatro ejemplares de flora enana, un perro y un conquistador español vistiendo un bombachón de gules y un casco morrión y sosteniendo una alabarda con su brazo d...

13th Light Tank Brigade (1938–1940) 31st Mechanized Brigade (1932–1938) Active1932–1940CountrySoviet UnionBranchRed ArmyTypeArmorSize256 tanks (1939)[1]Garrison Stary Petergof (1932–1938) Porkhov (1938–1940) EquipmentT-26, BT-7Engagements Winter War Invasion of Estonia Decorations Order of the Red Banner (1940)Battle honoursnamed for Uritsky (1934–1938)CommandersNotablecommanders Ivan Korchagin Viktor Baranov Military unit The 13th Light Tank Brigade (Russian: 13...

خلاص سامحت ألبوم إستوديو لـنوال الزغبي الفنان نوال الزغبي تاريخ الإصدار 2011 النوع بوب عربي اللغة العربية العلامة التجارية ميلودي خلاص سامحت    تعديل مصدري - تعديل   معرفش ليه هو ألبوم للمطربة اللبنانية نوال الزغبي، تم انتاجه وتوزيعه عام 2011 من قبل شركة ميلودي، والألب...

Transportation in MontanaConstruction sign for I-90 in Montana during the mid-20th centuryOverviewTransit typeRapid transit, commuter rail, buses, private automobile, taxicab, bicycle, pedestrian, highwaysWebsitehttp://www.mdt.mt.gov/OperationOperator(s)Montana Department of Transportation Main highways map Transportation in Montana comprises many different forms of travel. Montana shares a long border with Canada, hence international crossings are prevalent in the northern section of the sta...

This article includes a list of references, related reading, or external links, but its sources remain unclear because it lacks inline citations. Please help to improve this article by introducing more precise citations. (January 2015) (Learn how and when to remove this template message) Harleian SocietyFormation1869TypeHistorical societyRegistration no.253659Legal statusCharityPurposeHeraldic and genealogical study and researchHeadquartersCollege of Arms, London, United KingdomActivitie...

Novella by Clive Barker This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Cabal novella – news · newspapers · books · scholar · JSTOR (September 2014) (...

2018 anime show This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Yo-kai Watch Shadowside – news · newspapers · books · scholar · JSTOR (March 2018) (Learn how and when to remove this template message) Yo-kai Watch Shadowside妖怪ウォッチ シャドウサイド(Yōkai Wotchi Shadōsaido)GenreAction, supern...

Romblon's at-large congressional districtConstituencyfor the House of Representatives of the PhilippinesLocation of Romblon within the PhilippinesProvinceRomblonRegionMimaropaPopulation308,985 (2020)[1]Electorate206,119 (2022)[2]Area1,533.45 km2 (592.07 sq mi)Current constituencyCreated1919 (single-member district)RepresentativeEleandro Jesus F. MadronaPolitical party  NacionalistaCongressional blocMajority Romblon's at-large congressional district refers t...

1978 single by Queen Fat Bottomed GirlsUK single picture sleeveSingle by Queenfrom the album Jazz A-sideBicycle Race (double A-side)[1]Released 13 October 1978 (UK) 24 October 1978 (US) Recorded1978Genre Glam rock[2] hard rock[3] Length 4:16 (album version) 3:22 (single version) Label EMI (UK) Elektra (US) Songwriter(s)Brian MayProducer(s)QueenRoy Thomas BakerQueen singles chronology It's Late (1978) Fat Bottomed Girls / Bicycle Race (1978) Don't Stop Me Now (1979) Mus...

Brazilian actor, voice actor and singer Daniel BoaventuraBoaventura performing at the Jazz Festival Brasil in 2010BornDaniel do Rêgo Boaventura (1970-05-19) May 19, 1970 (age 53)Salvador, Bahia, BrazilOccupation(s)Actor (stage, film, voice), singerYears active1991–presentSpouseJuliana Serbeto (1998-2011)ChildrenJoana and IsabelaWebsitedanielboaventura.com.br Daniel Boaventura (May 19, 1970) is a Brazilian actor and singer.[1] Popular worldwide, Boaventura has held the lea...

Deemed university in India Birla Institute of Technology & Science, PilaniMottogyānaṁ paramaṁ balam (Sanskrit)Motto in EnglishKnowledge is power supremeTypeInstitute of Eminence Deemed UniversityEstablished 1946 as Birla College of Engineering 1964 as BITS Pilani[1] FounderG.D. BirlaChancellorKumar Mangalam BirlaVice-ChancellorV. Ramgopal RaoDirectorSudhirkumar Barai (Pilani campus)[2]Academic staff655[3]Students13,049 (2021-22)[3]Undergraduates10...

Season of television series MediumSeason 6DVD coverCountry of originUnited StatesNo. of episodes22ReleaseOriginal networkCBSOriginal releaseSeptember 25, 2009 (2009-09-25) –May 21, 2010 (2010-05-21)Season chronology← PreviousSeason 5(on NBC) Next →Season 7 List of episodes The sixth season of Medium, an American television series, began September 25, 2009, and ended on May 21, 2010. It is the first season to air on CBS after NBC canceled the show after 5 seasons...

Indian film studio Star StudiosLogo used as of May 27, 2022FormerlyFox Star Studios (2008–2022)TypeSubsidiaryIndustryMotion picturesFoundedMarch 2008; 15 years ago (2008-03)HeadquartersMumbai, Maharashtra, IndiaKey peopleBikram Duggal[1]OwnerNews Corporation (2008-2012)21st Century Fox (2013-2018)The Walt Disney Company (2019-present)ParentStar TV (2008-2014) Disney India (2019-present)Websitewww.disneystar.com/about-us/movies/ Star Studios (formerly known as ...

Period of hardship for German civilians during World War I A ration stamp of the city of Erfurt, 1917 for 1 kilogram (2.2 lb) of turnips per week The Turnip Winter (German: Steckrübenwinter) of 1916 to 1917 was a period of profound civilian hardship in Germany during World War I. Introduction For the duration of World War I, Germany was constantly under threat of starvation due to the success of the Allied blockade of Germany. Whatever meagre rations remained were sent to the troops fig...

Kembali kehalaman sebelumnya