<s>
A	O
text	B-General_Concept
file	I-General_Concept
(	O
sometimes	O
spelled	O
textfile	B-General_Concept
;	O
an	O
old	O
alternative	O
name	O
is	O
flatfile	O
)	O
is	O
a	O
kind	O
of	O
computer	B-Operating_System
file	I-Operating_System
that	O
is	O
structured	O
as	O
a	O
sequence	O
of	O
lines	B-General_Concept
of	O
electronic	O
text	O
.	O
</s>
<s>
A	O
text	B-General_Concept
file	I-General_Concept
exists	O
stored	B-General_Concept
as	I-General_Concept
data	I-General_Concept
within	O
a	O
computer	B-Application
file	I-Application
system	I-Application
.	O
</s>
<s>
In	O
operating	O
systems	O
such	O
as	O
CP/M	B-Application
and	O
MS-DOS	B-Application
,	O
where	O
the	O
operating	O
system	O
does	O
not	O
keep	O
track	O
of	O
the	O
file	O
size	O
in	O
bytes	O
,	O
the	O
end	O
of	O
a	O
text	B-General_Concept
file	I-General_Concept
is	O
denoted	O
by	O
placing	O
one	O
or	O
more	O
special	O
characters	O
,	O
known	O
as	O
an	O
end-of-file	B-Language
(	O
EOF	O
)	O
marker	O
,	O
as	O
padding	O
after	O
the	O
last	O
line	O
in	O
a	O
text	B-General_Concept
file	I-General_Concept
.	O
</s>
<s>
On	O
modern	O
operating	O
systems	O
such	O
as	O
Microsoft	B-Application
Windows	I-Application
and	O
Unix-like	B-Operating_System
systems	I-Operating_System
,	O
text	B-General_Concept
files	I-General_Concept
do	O
not	O
contain	O
any	O
special	O
EOF	O
character	O
,	O
because	O
file	B-Application
systems	I-Application
on	O
those	O
operating	O
systems	O
keep	O
track	O
of	O
the	O
file	O
size	O
in	O
bytes	O
.	O
</s>
<s>
Most	O
text	B-General_Concept
files	I-General_Concept
need	O
to	O
have	O
end-of-line	O
delimiters	B-Algorithm
,	O
which	O
are	O
done	O
in	O
a	O
few	O
different	O
ways	O
depending	O
on	O
operating	O
system	O
.	O
</s>
<s>
Some	O
operating	O
systems	O
with	O
record-orientated	B-Application
file	I-Application
systems	I-Application
may	O
not	O
use	O
new	O
line	O
delimiters	B-Algorithm
and	O
will	O
primarily	O
store	O
text	B-General_Concept
files	I-General_Concept
with	O
lines	B-General_Concept
separated	O
as	O
fixed	O
or	O
variable	O
length	O
records	O
.	O
</s>
<s>
"	O
Text	B-General_Concept
file	I-General_Concept
"	O
refers	O
to	O
a	O
type	O
of	O
container	O
,	O
while	O
plain	O
text	O
refers	O
to	O
a	O
type	O
of	O
content	O
.	O
</s>
<s>
At	O
a	O
generic	O
level	O
of	O
description	O
,	O
there	O
are	O
two	O
kinds	O
of	O
computer	B-Operating_System
files	I-Operating_System
:	O
text	B-General_Concept
files	I-General_Concept
and	O
binary	O
files	O
.	O
</s>
<s>
Because	O
of	O
their	O
simplicity	O
,	O
text	B-General_Concept
files	I-General_Concept
are	O
commonly	O
used	O
for	O
storage	B-General_Concept
of	O
information	O
.	O
</s>
<s>
Further	O
,	O
when	O
data	O
corruption	O
occurs	O
in	O
a	O
text	B-General_Concept
file	I-General_Concept
,	O
it	O
is	O
often	O
easier	O
to	O
recover	O
and	O
continue	O
processing	O
the	O
remaining	O
contents	O
.	O
</s>
<s>
A	O
disadvantage	O
of	O
text	B-General_Concept
files	I-General_Concept
is	O
that	O
they	O
usually	O
have	O
a	O
low	O
entropy	O
,	O
meaning	O
that	O
the	O
information	O
occupies	O
more	O
storage	B-General_Concept
than	O
is	O
strictly	O
necessary	O
.	O
</s>
<s>
A	O
simple	O
text	B-General_Concept
file	I-General_Concept
may	O
need	O
no	O
additional	O
metadata	O
(	O
other	O
than	O
knowledge	O
of	O
its	O
character	B-General_Concept
set	I-General_Concept
)	O
to	O
assist	O
the	O
reader	O
in	O
interpretation	O
.	O
</s>
<s>
A	O
text	B-General_Concept
file	I-General_Concept
may	O
contain	O
no	O
data	O
at	O
all	O
,	O
which	O
is	O
a	O
case	O
of	O
zero-byte	B-Application
file	I-Application
.	O
</s>
<s>
The	O
ASCII	B-Protocol
character	I-Protocol
set	I-Protocol
is	O
the	O
most	O
common	O
compatible	O
subset	O
of	O
character	B-General_Concept
sets	I-General_Concept
for	O
English-language	O
text	B-General_Concept
files	I-General_Concept
,	O
and	O
is	O
generally	O
assumed	O
to	O
be	O
the	O
default	O
file	O
format	O
in	O
many	O
situations	O
.	O
</s>
<s>
It	O
covers	O
American	O
English	O
,	O
but	O
for	O
the	O
British	O
pound	O
sign	O
,	O
the	O
euro	O
sign	O
,	O
or	O
characters	O
used	O
outside	O
English	O
,	O
a	O
richer	O
character	B-General_Concept
set	I-General_Concept
must	O
be	O
used	O
.	O
</s>
<s>
In	O
many	O
systems	O
,	O
this	O
is	O
chosen	O
based	O
on	O
the	O
default	O
locale	B-Device
setting	O
on	O
the	O
computer	O
it	O
is	O
read	O
on	O
.	O
</s>
<s>
Prior	O
to	O
UTF-8	O
,	O
this	O
was	O
traditionally	O
single-byte	O
encodings	O
(	O
such	O
as	O
ISO-8859-1	O
through	O
ISO-8859-16	O
)	O
for	O
European	O
languages	O
and	O
wide	B-Language
character	I-Language
encodings	O
for	O
Asian	O
languages	O
.	O
</s>
<s>
Unicode	O
is	O
an	O
attempt	O
to	O
create	O
a	O
common	O
standard	O
for	O
representing	O
all	O
known	O
languages	O
,	O
and	O
most	O
known	O
character	B-General_Concept
sets	I-General_Concept
are	O
subsets	O
of	O
the	O
very	O
large	O
Unicode	O
character	B-General_Concept
set	I-General_Concept
.	O
</s>
<s>
Although	O
there	O
are	O
multiple	O
character	B-General_Concept
encodings	I-General_Concept
available	O
for	O
Unicode	O
,	O
the	O
most	O
common	O
is	O
UTF-8	O
,	O
which	O
has	O
the	O
advantage	O
of	O
being	O
backwards-compatible	O
with	O
ASCII	B-Protocol
;	O
that	O
is	O
,	O
every	O
ASCII	B-Protocol
text	I-Protocol
file	I-Protocol
is	O
also	O
a	O
UTF-8	O
text	B-General_Concept
file	I-General_Concept
with	O
identical	O
meaning	O
.	O
</s>
<s>
Thus	O
,	O
a	O
common	O
operating	O
mode	O
of	O
UTF-8	O
capable	O
software	O
,	O
when	O
opening	O
files	O
of	O
unknown	O
encoding	O
,	O
is	O
to	O
try	O
UTF-8	O
first	O
and	O
fall	O
back	O
to	O
a	O
locale	B-Device
dependent	O
legacy	O
encoding	O
when	O
it	O
definitely	O
is	O
n't	O
UTF-8	O
.	O
</s>
<s>
On	O
most	O
operating	O
systems	O
,	O
the	O
name	O
text	B-General_Concept
file	I-General_Concept
refers	O
to	O
a	O
file	O
format	O
that	O
allows	O
only	O
plain	O
text	O
content	O
with	O
very	O
little	O
formatting	O
(	O
e.g.	O
,	O
no	O
bold	O
or	O
italic	O
types	O
)	O
.	O
</s>
<s>
Such	O
files	O
can	O
be	O
viewed	O
and	O
edited	O
on	O
text	O
terminals	O
or	O
in	O
simple	O
text	B-Application
editors	I-Application
.	O
</s>
<s>
Text	B-General_Concept
files	I-General_Concept
usually	O
have	O
the	O
MIME	B-Protocol
type	O
text/plain	B-General_Concept
,	O
usually	O
with	O
additional	O
information	O
indicating	O
an	O
encoding	O
.	O
</s>
<s>
MS-DOS	B-Application
and	O
Microsoft	B-Application
Windows	I-Application
use	O
a	O
common	O
text	B-General_Concept
file	I-General_Concept
format	I-General_Concept
,	O
with	O
each	O
line	B-General_Concept
of	I-General_Concept
text	I-General_Concept
separated	O
by	O
a	O
two-character	O
combination	O
:	O
carriage	O
return	O
(	O
CR	O
)	O
and	O
line	O
feed	O
(	O
LF	O
)	O
.	O
</s>
<s>
It	O
is	O
common	O
for	O
the	O
last	O
line	B-General_Concept
of	I-General_Concept
text	I-General_Concept
not	O
to	O
be	O
terminated	O
with	O
a	O
CR-LF	O
marker	O
,	O
and	O
many	O
text	B-Application
editors	I-Application
(	O
including	O
Notepad	B-Application
)	O
do	O
not	O
automatically	O
insert	O
one	O
on	O
the	O
last	O
line	O
.	O
</s>
<s>
On	O
Microsoft	B-Application
Windows	I-Application
operating	I-Application
systems	I-Application
,	O
a	O
file	O
is	O
regarded	O
as	O
a	O
text	B-General_Concept
file	I-General_Concept
if	O
the	O
suffix	O
of	O
the	O
name	O
of	O
the	O
file	O
(	O
the	O
"	O
filename	O
extension	O
"	O
)	O
is	O
.txt	B-General_Concept
.	O
</s>
<s>
However	O
,	O
many	O
other	O
suffixes	O
are	O
used	O
for	O
text	B-General_Concept
files	I-General_Concept
with	O
specific	O
purposes	O
.	O
</s>
<s>
For	O
example	O
,	O
source	O
code	O
for	O
computer	O
programs	O
is	O
usually	O
kept	O
in	O
text	B-General_Concept
files	I-General_Concept
that	O
have	O
file	O
name	O
suffixes	O
indicating	O
the	O
programming	O
language	O
in	O
which	O
the	O
source	O
is	O
written	O
.	O
</s>
<s>
Most	O
Microsoft	B-Application
Windows	I-Application
text	B-General_Concept
files	I-General_Concept
use	O
ANSI	O
,	O
OEM	O
,	O
Unicode	O
or	O
UTF-8	O
encoding	O
.	O
</s>
<s>
What	O
Microsoft	B-Application
Windows	I-Application
terminology	O
calls	O
"	O
ANSI	O
encodings	O
"	O
are	O
usually	O
single-byte	O
ISO/IEC	O
8859	O
encodings	O
(	O
i.e.	O
</s>
<s>
ANSI	O
in	O
the	O
Microsoft	B-Application
Notepad	I-Application
menus	O
is	O
really	O
"	O
System	O
Code	O
Page	O
"	O
,	O
non-Unicode	O
,	O
legacy	O
encoding	O
)	O
,	O
except	O
for	O
in	O
locales	B-Device
such	O
as	O
Chinese	O
,	O
Japanese	O
and	O
Korean	O
that	O
require	O
double-byte	O
character	B-General_Concept
sets	I-General_Concept
.	O
</s>
<s>
ANSI	O
encodings	O
were	O
traditionally	O
used	O
as	O
default	O
system	O
locales	B-Device
within	O
Microsoft	B-Application
Windows	I-Application
,	O
before	O
the	O
transition	O
to	O
Unicode	O
.	O
</s>
<s>
By	O
contrast	O
,	O
OEM	O
encodings	O
,	O
also	O
known	O
as	O
DOS	O
code	O
pages	O
,	O
were	O
defined	O
by	O
IBM	O
for	O
use	O
in	O
the	O
original	O
IBM	B-Device
PC	I-Device
text	O
mode	O
display	O
system	O
.	O
</s>
<s>
"	O
Unicode	O
"	O
-encoded	O
Microsoft	B-Application
Windows	I-Application
text	B-General_Concept
files	I-General_Concept
contain	O
text	O
in	O
UTF-16	O
Unicode	O
Transformation	O
Format	O
.	O
</s>
<s>
Although	O
UTF-8	O
does	O
not	O
suffer	O
from	O
endianness	O
problems	O
,	O
many	O
Microsoft	B-Application
Windows	I-Application
programs	O
(	O
i.e.	O
</s>
<s>
Notepad	B-Application
)	O
prepend	O
the	O
contents	O
of	O
UTF-8-encoded	O
files	O
with	O
BOM	O
,	O
to	O
differentiate	O
UTF-8	O
encoding	O
from	O
other	O
8-bit	O
encodings	O
.	O
</s>
<s>
On	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
,	O
text	B-General_Concept
files	I-General_Concept
format	O
is	O
precisely	O
described	O
:	O
POSIX	O
defines	O
a	O
text	B-General_Concept
file	I-General_Concept
as	O
a	O
file	O
that	O
contains	O
characters	O
organized	O
into	O
zero	O
or	O
more	O
lines	B-General_Concept
,	O
where	O
lines	B-General_Concept
are	O
sequences	O
of	O
zero	O
or	O
more	O
non-newline	O
characters	O
plus	O
a	O
terminating	O
newline	O
character	O
,	O
normally	O
LF	O
.	O
</s>
<s>
Additionally	O
,	O
POSIX	O
defines	O
a	O
as	O
a	O
text	B-General_Concept
file	I-General_Concept
whose	O
characters	O
are	O
printable	O
or	O
space	O
or	O
backspace	O
according	O
to	O
regional	O
rules	O
.	O
</s>
<s>
Prior	O
to	O
the	O
advent	O
of	O
macOS	B-Application
,	O
the	O
classic	B-Application
Mac	I-Application
OS	I-Application
system	O
regarded	O
the	O
content	O
of	O
a	O
file	O
(	O
the	O
data	B-Operating_System
fork	I-Operating_System
)	O
to	O
be	O
a	O
text	B-General_Concept
file	I-General_Concept
when	O
its	O
resource	B-Operating_System
fork	I-Operating_System
indicated	O
that	O
the	O
type	O
of	O
the	O
file	O
was	O
"	O
TEXT	O
"	O
.	O
</s>
<s>
Lines	B-General_Concept
of	O
classic	B-Application
Mac	I-Application
OS	I-Application
text	B-General_Concept
files	I-General_Concept
are	O
terminated	O
with	O
CR	O
characters	O
.	O
</s>
<s>
Being	O
a	O
Unix-like	B-Operating_System
system	I-Operating_System
,	O
macOS	B-Application
uses	O
Unix	O
format	O
for	O
text	B-General_Concept
files	I-General_Concept
.	O
</s>
<s>
Uniform	B-Operating_System
Type	I-Operating_System
Identifier	I-Operating_System
(	O
UTI	O
)	O
used	O
for	O
text	B-General_Concept
files	I-General_Concept
in	O
macOS	B-Application
is	O
"	O
public.plain-text	O
"	O
;	O
additional	O
,	O
more	O
specific	O
UTIs	O
are	O
:	O
"	O
public.utf8-plain-text	O
"	O
for	O
utf-8-encoded	O
text	O
,	O
"	O
public.utf16-external-plain-text	O
"	O
and	O
"	O
public.utf16-plain-text	O
"	O
for	O
utf-16-encoded	O
text	O
and	O
"	O
com.apple.traditional-mac-plain-text	O
"	O
for	O
classic	B-Application
Mac	I-Application
OS	I-Application
text	B-General_Concept
files	I-General_Concept
.	O
</s>
<s>
When	O
opened	O
by	O
a	O
text	B-Application
editor	I-Application
,	O
human-readable	O
content	O
is	O
presented	O
to	O
the	O
user	O
.	O
</s>
<s>
Depending	O
on	O
the	O
application	O
,	O
control	O
codes	O
may	O
be	O
rendered	O
either	O
as	O
literal	O
instructions	O
acted	O
upon	O
by	O
the	O
editor	O
,	O
or	O
as	O
visible	O
escape	B-Algorithm
characters	I-Algorithm
that	O
can	O
be	O
edited	O
as	O
plain	O
text	O
.	O
</s>
<s>
Though	O
there	O
may	O
be	O
plain	O
text	O
in	O
a	O
text	B-General_Concept
file	I-General_Concept
,	O
control	O
characters	O
within	O
the	O
file	O
(	O
especially	O
the	O
end-of-file	B-Language
character	O
)	O
can	O
render	O
the	O
plain	O
text	O
unseen	O
by	O
a	O
particular	O
method	O
.	O
</s>
