Edge Rewrite
Jump to content

// Workers AI · dad joke modeWhat did the Unicode block say? It had special characters.

From Wikipedia, the free encyclopedia
(Redirected from Replacement character)
Specials
RangeU+FFF0..U+FFFF
(16 code points)
PlaneBMP
ScriptsCommon
Assigned5 code points
Unused9 reserved code points
2 non-characters
Unicode Version History
1.0.0 (1991)1 (+1)
2.1 (1998)2 (+1)
3.0 (1999)5 (+3)
Unicode documentation
Code chart ∣ Web page
Note: [1][2]

Specials is a short Unicode block of characters allocated at the very end of the Basic Multilingual Plane, at U+FFF0–FFFF, containing these code points:

  • U+FFF9 INTERLINEAR ANNOTATION ANCHOR, marks start of annotated text
  • U+FFFA INTERLINEAR ANNOTATION SEPARATOR, marks start of annotating character(s)
  • U+FFFB INTERLINEAR ANNOTATION TERMINATOR, marks end of annotation block
  • U+FFFC OBJECT REPLACEMENT CHARACTER, placeholder in the text for another unspecified object, for example in a compound document.
  • U+FFFD REPLACEMENT CHARACTER used to replace an unknown, unrecognised, or unrepresentable character
  • U+FFFE <noncharacter-FFFE> not a character.
  • U+FFFF <noncharacter-FFFF> not a character.

U+FFFE <noncharacter-FFFE> and U+FFFF <noncharacter-FFFF> are noncharacters, meaning they are reserved but do not cause ill-formed Unicode text. Versions of the Unicode standard from 3.1.0 to 6.3.0 claimed that these characters should never be interchanged, leading some applications to use them to guess text encoding by interpreting the presence of either as a sign that the text is not Unicode. However, Corrigendum #9 later specified that noncharacters are not illegal and so this method of checking text encoding is incorrect.[3] An example of an internal usage of U+FFFE is the CLDR algorithm; this extended Unicode algorithm maps the noncharacter to a minimal, unique primary weight.[4]

Unicode's U+FEFF ZERO WIDTH NO-BREAK SPACE character can be inserted at the beginning of a Unicode text as a byte order mark to signal its endianness: a program reading a text encoded in for example UTF-16 and encountering U+FFFE <noncharacter-FFFE> would then know that it should switch the byte order for all the following characters.

Its block name in Unicode 1.0 was Special.[5]

Replacement character

[edit source]
Replacement character

The replacement character (often displayed as a rhombus with a question mark) is a symbol found in the Unicode standard at code point U+FFFD in the Specials table. It is used to indicate problems when a system is unable to render a stream of data to correct symbols.[6]

At one time, the replacement character was often used when there was no glyph available in a font for that character, as in font substitution. However, most modern text rendering systems instead use a font's .notdef character, which in most cases is an empty box, or a ? or X in a box[7] (this browser displays 􏿾 for U+10FFEE), sometimes called a "tofu". There is no Unicode code point for this symbol.

Thus the replacement character is now only seen for encoding errors.

As an example, an E-mail message that is encoded in Windows-1252 and contains non-breaking spaces in it will contain the byte 0xA0 for each non-breaking space. The message is then opened in a client that assumes the input is UTF-8. Since bytes between 0x80 and 0xFF are not valid as standalone bytes in UTF-8, the client opening this message could replace these bytes with the replacement character to produce a valid string of Unicode code points for display.[8]

The replacement character (0xEF 0xBF 0xBD) may get written out if the viewer saves or copies the text; these three bytes will then replace every encoding error. Even if the result is viewed as Windows-1252, these will now all display identically as �.[8] As all UTF-8 encoding errors are turned into the same sequence, it is impossible to recover the original text. Some software programs translate invalid UTF-8 bytes to matching characters in Windows-1252 (since that is the most common source of these errors) or into U+CDxx, so less information is lost,[citation needed] and the result that the replacement character is never seen.

Unicode chart

[edit source]
Specials[1][2][3]
Official Unicode Consortium code chart (PDF)
 0123456789ABCDEF
U+FFFx IAA IAS IAT
Notes
1.^As of Unicode version 17.0
2.^Grey areas indicate non-assigned code points
3.^Black areas indicate noncharacters (code points that are guaranteed never to be assigned as encoded characters in the Unicode Standard)

History

[edit source]

The following Unicode-related documents record the purpose and process of defining specific characters in the Specials block:

See also

[edit source]

References

[edit source]
  1. "Unicode character database". The Unicode Standard. Retrieved 2023-07-26.
  2. "Enumerated Versions of The Unicode Standard". The Unicode Standard. Retrieved 2023-07-26.
  3. "Corrigendum #9: Clarification About Noncharacters". The Unicode Standard. Archived from the original on Jun 10, 2023. Retrieved 2023-06-07.
  4. "Unicode Technical Standard #35". Unicode Locale Data Markup Language (LDML). Retrieved 2024-08-27.
  5. "3.8: Block-by-Block Charts" (PDF). The Unicode Standard. Version 1.0. Unicode Consortium. Archived (PDF) from the original on 2021-02-11. Retrieved 2020-09-30.
  6. Wichary, Marcin (September 29, 2020). "When fonts fall". Figma. Archived from the original on 13 June 2021. Retrieved 6 June 2021.
  7. "Recommendations for OpenType Fonts (OpenType 1.7) - Typography". Microsoft Learn. Archived from the original on 19 October 2020. Retrieved 18 October 2020.
  8. 1 2 "Why do my sent messages magically add "�" at the end of my sentences?". 6 December 2017. Retrieved 2 August 2026.