From Surf Wiki (app.surf) — the open knowledge base
Character (computing)
Symbols encoded in computers to make text
Symbols encoded in computers to make text
In computing and telecommunications, a character is the encoded representation of a natural language character (including letter, numeral and punctuation), whitespace (space or tab), or a control character (controls computer hardware that consumes character-based data). A sequence of characters is called a string.
Some character encoding systems represent each character using a fixed number of bits whereas other systems use varying sizes. Various fixed-length sizes were used for now obsolete systems such as the six-bit character code, the five-bit Baudot code and even 4-bit systems (with only 16 possible values). The more modern ASCII system uses the 8-bit byte for each character. Today, the Unicode-based UTF-8 encoding uses a varying number of byte-sized code units to define a code point which combine to encode a character.
Terminology
Character
In general, a character is a symbol (such as a letter or number) that represents information, and in the context of computing is a representation of such a symbol that may be accepted by a computer. A character implies an encoding of information, often as defined by a standard such as ANSI or Unicode.
Character set
A character set identifies a repertoire of characters that are each mapped to a unique numeric value.
Glyph
Glyph describes a particular visual appearance of a character. Many computer fonts consist of glyphs that are indexed by the numerical code of the corresponding character.
With the advent and widespread acceptance of Unicode and bit-agnostic coded character sets, a character is increasingly being seen as a unit of information, independent of any particular visual manifestation. The 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 letter aleph ("א") is often used by mathematicians to denote certain kinds of 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 points"), though they may be rendered identically. Conversely, the Chinese logogram for water ("水") may have a slightly different appearance in Japanese texts than it does in Chinese texts, and local typefaces may reflect this. But nonetheless in Unicode they are considered the same character, and share the same code point.
The Unicode standard 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 addressed by Unicode which allocates a code point to each of:
- 'i ' (U+0069),
- the combining 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 'i ' with the combining diaeresis: (U+0069 LATIN SMALL LETTER I + U+0308 COMBINING DIAERESIS); this is also rendered as 'ï '.
char
In C, (short for character) is a data type with size one byte, but unlike the de facto size of byte as 8 bits, this use of byte is less specific. Byte is defined to be large enough to contain any member of the "basic execution character set". The number of bits used by a compiler is accessible via the macro. By far the most common size is 8 bits, and POSIX requires it to be 8 bits. In modern C standards, is required to hold UTF-8 code units which requires a minimum size of 8 bits.
Since a Unicode code point may require as many as 21 bits. the type is generally not large enough for every character. Nonetheless, the type is well-suited for the UTF-8 encoding where each code point requires 1 to 4 bytes.
The fact that a character was historically stored in a single byte has led to the terms "char" and "character" being used interchangeably and this leads to confusion today when multibyte encodings such as UTF-8 are used. Modern POSIX documentation attempts to fix this by defining "character" as a sequence of one or more bytes representing a single graphic symbol or control code, and uses "byte" when referring to char data. However it still contains errors such as defining an array of as a character array (rather than a byte array).
Unicode can be stored in strings of code units that are larger than called wide characters. The original C type was called wchar_t. Due to some platforms defining as 16 bits and others defining it as 32 bits, current versions provide unambiguous and . Even then the objects being stored might not be characters, for instance the variable-length UTF-16 is often stored in arrays of .
Other languages also have a type. Many, including C++, use 8-bit bytes like C. Others, such as Java, use 2-byte, wide storage to more directly accommodate UTF-16.
References
References
- (2008-05-05). "Moving to Unicode 5.1". Google Blog.
- "ISO/IEC 9899:2018 - Information technology -- Programming languages -- C".
- "ISO/IEC 14882:2011".
- "<limits.h>".
- "Glossary of Unicode Terms – Code Point".
- "POSIX definition of Character".
- "POSIX strlen reference".
- "POSIX definition of Character Array".
- (December 1973). "MCS-4 Assembly Language Programming Manual - The INTELLEC 4 Microcomputer System Programming Manual". [[Intel Corporation]].
- (1958). "System design of the Gamma 60".
- (1962). "Planning a Computer System – Project Stretch". [[McGraw-Hill Book Company, Inc.]] / The Maple Press Company, York, PA..
This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.
Ask Mako anything about Character (computing) — get instant answers, deeper analysis, and related topics.
Research with MakoFree with your Surf account
Create a free account to save articles, ask Mako questions, and organize your research.
Sign up freeThis content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.
Report