Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Character (computing)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Symbols encoded in computers to make text}} {{Use dmy dates|date=March 2020|cs1-dates=y}} {{SpecialChars}} [[File:String example.png|alt=Diagram of String data in computing. Shows the word "example" with each letter in a separate box. The word "String" is above, referring to the entire sentence. The label "Character" is below and points to an individual box.|thumb|A [[string (computer science)|string]] of seven characters]] In [[computing]] and [[telecommunications]], a '''character''' is the internal representation of a [[character (symbol)]] used within a computer or system. Examples of characters include [[letter (alphabet)|letters]], [[numerical digit]]s, [[punctuation]] marks (such as "." or "-"), and [[whitespace character|whitespace]]. The concept also includes [[control character]]s, which do not correspond to visible symbols but rather to instructions to format or process the text. Examples of control characters include [[carriage return]] and [[tab key|tab]] as well as other instructions to [[computer printer|printer]]s or other devices that display or otherwise process text. Characters are typically combined into ''[[string (computer science)|string]]s''. Historically, the term ''character'' was used to denote a specific number of contiguous [[bit]]s. While a character is most commonly assumed to refer to 8 bits (one [[byte]]) today, other options like the [[six-bit_character_code|6-bit character code]] were once popular,<ref name="Dreyfus_1958_Gamma60"/><ref name="Buchholz_1962"/> and the [[Baudot code|5-bit Baudot code]] has been used in the past as well. The term has even been applied to 4 bits<ref name="Intel_1973_MCS-4"/> with only 16 possible values. All modern systems use a varying-size sequence of these fixed-sized pieces, for instance [[UTF-8]] uses a varying number of 8-bit [[code unit]]s to define a "[[code point]]" and [[Unicode]] uses varying number of ''those'' to define a "character". ==Encoding== {{Main|Character encoding}} Computers and communication equipment represent characters using a [[character encoding]] that assigns each character to something{{snd}} an [[integer]] quantity represented by a sequence of [[numerical digit|digits]]<!-- binary or decimal, depending on the particular computer -->, typically{{snd}} that can be [[computer storage|stored]] or transmitted through a [[computer network|network]]. Two examples of usual encodings are [[ASCII]] and the [[UTF-8]] encoding for [[Unicode]]. While most character encodings map characters to numbers and/or bit sequences, [[Morse code]] instead represents characters using a series of electrical impulses of varying length. ==Terminology== {{More citations needed section|date=January 2019}} The dictionary Merriam-Webster defines a "character", in the relevant sense, as "a symbol (such as a letter or number) that represents information; ''also'': a representation of such a symbol that may be accepted by a computer".<ref name="MW_Definition"/> Historically, the term ''character'' has been widely used by industry professionals to refer to an ''encoded character'', often as defined by the programming language or [[application programming interface|API]]. Likewise, ''character set'' has been widely used to refer to a specific repertoire of characters that have been mapped to specific bit sequences or numerical codes. The term [[glyph]] is used to describe a particular visual appearance of a character. Many computer [[typeface|font]]s consist of glyphs that are indexed by the numerical code of the corresponding character. With the advent and widespread acceptance of Unicode<ref name="movingtounicode"/> and bit-agnostic ''coded character sets'',{{clarify|date=June 2009}} a character is increasingly being seen as a unit of [[data|information]], independent of any particular visual manifestation. The [[Universal Character Set|ISO/IEC 10646 (Unicode) International Standard]] defines ''character'', or ''abstract character'' as "a member of a set of elements used for the organization, control, or representation of data". Unicode's definition supplements this with explanatory notes that encourage the reader to differentiate between characters, graphemes, and glyphs, among other things. Such differentiation is an instance of the wider theme of the [[separation of presentation and content]]. For example, the [[Hebrew alphabet|Hebrew letter]] [[aleph]] ("א") is often used by mathematicians to denote certain kinds of [[aleph number|infinity]] (ℵ), but it is also used in ordinary Hebrew text. In Unicode, these two uses are considered different characters, and have two different Unicode numerical identifiers ("[[code point]]s"), though they may be rendered identically. Conversely, the [[Chinese script|Chinese]] [[logogram]] for water ("水") may have a slightly different appearance in [[Japanese script|Japanese]] texts than it does in Chinese texts, and local [[typeface]]s may reflect this. But nonetheless in Unicode they are considered the same character, and share the same code point. The Unicode standard also differentiates between these abstract characters and ''coded characters'' or ''encoded characters'' that have been paired with numeric codes that facilitate their representation in computers. ===Combining character=== The [[combining character]] is also addressed by Unicode. For instance, Unicode allocates a code point to each of * 'i ' (U+0069), * the combining [[Diaeresis (diacritic)|diaeresis]] (U+0308), and * 'ï' (U+00EF). This makes it possible to code the middle character of the word 'naïve' either as a single character 'ï' or as a combination of the character {{nowrap|'i '}} with the combining diaeresis: (U+0069 LATIN SMALL LETTER I + U+0308 COMBINING DIAERESIS); this is also rendered as {{nowrap|'ï '}}. These are considered canonically equivalent by the Unicode standard. ==char== {{See also|C data types}} A ''char'' in the [[C (programming language)|C programming language]] is a data type with the size of exactly one [[byte]],<ref name="ISO9899"/><ref name="ISO14882"/> which in turn is defined to be large enough to contain any member of the "basic execution character set". The exact number of bits can be checked via {{code|CHAR_BIT}} macro. By far the most common size is 8 bits, and the POSIX standard ''requires'' it to be 8 bits.<ref name="Opengroup_Limits"/> In newer C standards ''char'' is required to hold [[UTF-8]] code units<ref name="ISO9899"/><ref name="ISO14882"/> which requires a minimum size of 8 bits. A [[Unicode]] code point may require as many as 21 bits.<ref name="Unicode_Glossary"/> This will not fit in a ''char'' on most systems, so more than one is used for some of them, as in the variable-length encoding [[UTF-8]] where each code point takes 1 to 4 bytes. Furthermore, a "character" may require more than one code point (for instance with [[combining character]]s), depending on what is meant by the word "character". The fact that a character was historically stored in a single byte led to the two terms ("char" and "character") being used interchangeably in most documentation. This often makes the documentation confusing or misleading when multibyte encodings such as UTF-8 are used, and has led to inefficient and incorrect implementations of string manipulation functions (such as computing the "length" of a string as a count of code units rather than bytes). Modern POSIX documentation attempts to fix this, defining "character" as a sequence of one or more bytes representing a single graphic symbol or control code, and attempts to use "byte" when referring to char data.<ref name="Opengroup_POSIX_Character"/><ref name="Opengroup_POSIX_Strlen"/> However it still contains errors such as defining an array of ''char'' as a ''character array'' (rather than a ''byte array'').<ref name="Opengroup_POSIX_CharacterArray"/> Unicode can also be stored in strings made up of code units that are larger than ''char''. These are called "[[wide character]]s". The original C type was called ''{{not a typo|[[wchar_t]]}}<!-- do not remove the underscore -->''. Due to some platforms defining ''wchar_t'' as 16 bits and others defining it as 32 bits, recent versions have added ''char16_t'', ''char32_t''. Even then the objects being stored might not be characters, for instance the variable-length [[UTF-16]] is often stored in arrays of ''char16_t''. Other languages also have a ''char'' type. Some such as [[C++]] use at least 8 bits like C.<ref name="ISO14882"/> Others such as [[Java (programming language)|Java]] use 16 bits for ''char'' in order to represent UTF-16 values. ==See also== * [[Character literal]] * [[Character (symbol)]] * [[Fill character]] * [[Combining character]] * [[Universal Character Set characters]] * [[Homoglyph]] ==References== {{Reflist|refs= <ref name="MW_Definition">{{cite web |title=Definition of CHARACTER |website=Merriam-Webster |url=http://www.merriam-webster.com/dictionary/character |access-date=2018-04-01}} </ref> <ref name="movingtounicode">{{cite web |title=Moving to Unicode 5.1 |author-last=Davis |author-first=Mark |work=Google Blog |date=2008-05-05 |url=http://googleblog.blogspot.com/2008/05/moving-to-unicode-51.html |access-date=2008-09-28}}</ref> <ref name="ISO9899">{{cite book|url=https://www.iso.org/standard/74528.html|title=ISO/IEC 9899:2018 - Information technology -- Programming languages -- C|chapter=§5.2.4.2.1 Sizes of integer types <limits.h> / §6.2.5 Types / §6.5.3.4 The sizeof and _Alignof operators|website=www.iso.org}}</ref> <ref name="ISO14882">{{cite book |title=ISO/IEC 14882:2011 |chapter=§1.7 The C++ memory model / §5.3.3 Sizeof |url=http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=50372}}</ref> <ref name="Opengroup_Limits">{{cite web |title=<limits.h> |website=pubs.opengroup.org |url=http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html |access-date=2018-04-01}}</ref> <ref name="Unicode_Glossary">{{cite web |title=Glossary of Unicode Terms – Code Point |url=https://www.unicode.org/glossary/#code_point |access-date=2019-05-14}}</ref> <ref name="Opengroup_POSIX_Character">{{cite web |title=POSIX definition of Character |url=http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_87}}</ref> <ref name="Opengroup_POSIX_Strlen">{{cite web |title=POSIX strlen reference |url=http://pubs.opengroup.org/onlinepubs/009695399/functions/strlen.html}}</ref> <ref name="Opengroup_POSIX_CharacterArray">{{cite web |title=POSIX definition of Character Array |url=http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_88}}</ref> <ref name="Intel_1973_MCS-4">{{cite book |title=MCS-4 Assembly Language Programming Manual - The INTELLEC 4 Microcomputer System Programming Manual |chapter=Terms And Abbreviations |edition=Preliminary |publisher=[[Intel Corporation]] |date=December 1973 |location=Santa Clara, California, US |id=MCS-030-1273-1 |pages=v, ((2-6)) |url=http://bitsavers.trailing-edge.com/components/intel/MCS4/MCS-4_Assembly_Language_Programming_Manual_Dec73.pdf |access-date=2020-03-02 |url-status=live |archive-url=https://web.archive.org/web/20200301235541/http://bitsavers.trailing-edge.com/components/intel/MCS4/MCS-4_Assembly_Language_Programming_Manual_Dec73.pdf |archive-date=2020-03-01 |quote=[…] [[Bit]] - The smallest unit of information which can be represented. (A bit may be in one of two states I 0 or 1). […] [[Byte]] - A group of 8 contiguous bits occupying a single memory location. […] Character - A group of 4 contiguous bits of data. […]}} (NB. This [[Intel 4004]] manual uses the term ''character'' referring to ''4-bit'' rather than 8-bit ''data'' entities. Intel switched to use the more common term ''[[nibble]]'' for 4-bit entities in their documentation for the succeeding processor [[Intel 4040|4040]] in 1974 already.)</ref> <ref name="Dreyfus_1958_Gamma60">{{cite conference |title=System design of the Gamma 60 |author-first=Phillippe |author-last=Dreyfus |author-link=Philippe Dreyfus |book-title=Managing Requirements Knowledge, International Workshop on, Los Angeles |date=1958 |location=New York |pages=130–133 |doi=10.1109/AFIPS.1958.32 |quote=[…] Internal data code is used: Quantitative (numerical) data are coded in a 4-bit decimal code; qualitative (alpha-numerical) data are coded in a 6-bit alphanumerical code. The internal [[instruction code]] means that the instructions are coded in straight binary code.<br/>As to the internal information length, the information quantum is called a "[[catena (unit)|catena]]," and it is composed of 24 bits representing either 6 decimal digits, or 4 alphanumerical characters. This quantum must contain a multiple of 4 and 6 bits to represent a whole number of decimal or alphanumeric characters. Twenty-four bits was found to be a good compromise between the minimum 12 bits, which would lead to a too-low transfer flow from a parallel readout core memory, and 36 bits or more, which was judged as too large an information quantum. The catena is to be considered as the equivalent of a character in variable [[word (computer architecture)|word]] length machines, but it cannot be called so, as it may contain several characters. It is transferred in series to and from the main memory.<br/>Not wanting to call a "quantum" a word, or a set of characters a letter, (a word is a word, and a quantum is something else), a new word was made, and it was called a "catena." It is an English word and exists in [[Webster's]] although it does not in French. Webster's definition of the word catena is, "a connected series;" therefore, a 24-bit information item. The word catena will be used hereafter.<br/>The internal code, therefore, has been defined. Now what are the external data codes? These depend primarily upon the information handling device involved. The {{ill|Bull Gamma 60{{!}}Gamma 60|fr|Gamma 60}} is designed to handle information relevant to any binary coded structure. Thus an 80-column punched card is considered as a 960-bit information item; 12 rows multiplied by 80 columns equals 960 possible punches; is stored as an exact image in 960 magnetic cores of the main memory with 2 card columns occupying one catena. […]}}</ref> <ref name="Buchholz_1962">{{citation |title=Planning a Computer System – Project Stretch |author-first1=Gerrit Anne |author-last1=Blaauw |author-link1=Gerrit Anne Blaauw |author-first2=Frederick Phillips |author-last2=Brooks Jr. |author-link2=Frederick Phillips Brooks Jr. |author-first3=Werner |author-last3=Buchholz |author-link3=Werner Buchholz |editor-first=Werner |editor-last=Buchholz |editor-link=Werner Buchholz |publisher=[[McGraw-Hill Book Company, Inc.]] / The Maple Press Company, York, PA. |lccn=61-10466 |date=1962 |chapter=4: Natural Data Units |pages=39–40 |chapter-url=http://archive.computerhistory.org/resources/text/IBM/Stretch/pdfs/Buchholz_102636426.pdf |access-date=2017-04-03 |url-status=live |archive-url=https://web.archive.org/web/20170403014651/http://archive.computerhistory.org/resources/text/IBM/Stretch/pdfs/Buchholz_102636426.pdf |archive-date=2017-04-03 |quote=[…] Terms used here to describe the structure imposed by the machine design, in addition to ''[[bit]]'', are listed below.<br/>''[[Byte]]'' denotes a group of bits used to encode a character, or the number of bits transmitted in parallel to and from input-output units. A term other than ''character'' is used here because a given character may be represented in different applications by more than one code, and different codes may use different numbers of bits (i.e., different byte sizes). In input-output transmission the grouping of bits may be completely arbitrary and have no relation to actual characters. (The term is coined from ''[[bite]]'', but respelled to avoid accidental mutation to ''bit''.)<br/>A ''[[word (computer architecture)|word]]'' consists of the number of data bits transmitted in parallel from or to memory in one memory cycle. [[Word size]] is thus defined as a structural property of the memory. (The term ''[[catena (unit)|catena]]'' was coined for this purpose by the designers of the [[Groupe Bull|Bull]] {{ill|Bull Gamma 60{{!}}GAMMA 60|fr|Gamma 60}} computer.)<br/>''[[Block (data storage)|Block]]'' refers to the number of words transmitted to or from an input-output unit in response to a single input-output instruction. Block size is a structural property of an input-output unit; it may have been fixed by the design or left to be varied by the program. […]}}</ref> }} ==External links== * [http://www.linfo.org/character.html Characters: A Brief Introduction] by The Linux Information Project (LINFO) * [https://web.archive.org/web/20180814112756/http://charter724.info/ ISO/IEC TR 15285:1998] summarizes the ISO/IEC's character model, focusing on terminology definitions and differentiating between characters and glyphs {{Data types}} {{Authority control}} [[Category:Character encoding]] [[Category:Data types]] [[Category:Digital typography]] [[Category:Primitive types]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Clarify
(
edit
)
Template:Code
(
edit
)
Template:Data types
(
edit
)
Template:Main
(
edit
)
Template:More citations needed section
(
edit
)
Template:Not a typo
(
edit
)
Template:Nowrap
(
edit
)
Template:Reflist
(
edit
)
Template:See also
(
edit
)
Template:Short description
(
edit
)
Template:Snd
(
edit
)
Template:SpecialChars
(
edit
)
Template:Use dmy dates
(
edit
)