Jump to content

Bell character: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Sandrohacker.
Tags: Reverted Visual edit Mobile edit Mobile web edit
 
(13 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Short description|Device control code used to alert operators}}
{{refimprove|date=July 2011}}
{{refimprove|date=July 2011}}
{{Distinguish|Bell code}}


A '''bell code''' (sandrohacker '''bell character''') is a device [[control character|control code]] originally sent to ring a small electromechanical bell on [[stock ticker|tickers]] and other [[teleprinter]]s and teletypewriters to alert operators at the other end of the line, often of an incoming message. Though tickers punched the bell codes into their [[Ticker tape|tapes]],<ref>{{cite web|title=Baudot |url=http://chem.ch.huji.ac.il/history/baudot.html |access-date=February 1, 2009 |url-status=dead |archive-url=https://web.archive.org/web/20081219135647/http://chem.ch.huji.ac.il/history/baudot.html |archive-date=December 19, 2008 }}</ref> printers generally do not print a character when the bell code is received. Bell codes are usually represented by the label "<code>BEL</code>". They have been used since 1870 (initially in [[Baudot code]]).{{citation needed|date=September 2010}}
A '''bell character''' (sometimes '''bell code''') is a device [[control character|control code]] originally sent to ring a small electromechanical bell on [[stock ticker|tickers]] and other [[teleprinter]]s and teletypewriters to alert operators at the other end of the line, often of an incoming message. Though tickers punched the bell codes into their tapes,<ref>{{cite web|title=Baudot |url=http://chem.ch.huji.ac.il/history/baudot.html |access-date=February 1, 2009 |url-status=dead |archive-url=https://web.archive.org/web/20081219135647/http://chem.ch.huji.ac.il/history/baudot.html |archive-date=December 19, 2008 }}</ref> printers generally do not print a character when the bell code is received. Bell codes are usually represented by the label "<code>BEL</code>". They have been used since 1870 (initially in the [[Baudot code]]).<ref>{{cite web | last = Smith | first = Gil | title = Teletype Communication Codes | publisher = Baudot.net | year = 2001 | url = http://www.baudot.net/docs/smith--teletype-codes.pdf | access-date = 2008-07-11| archive-url= https://web.archive.org/web/20080820043949/http://www.baudot.net/docs/smith--teletype-codes.pdf| archive-date= 20 August 2008 <!--DASHBot-->|url-status = live}}</ref>


To maintain backward compatibility, video display [[computer terminal|terminal]]s (VDTs) that replaced teletypewriters included speakers or buzzers to perform the same function, as did the personal computers that followed. Modern [[terminal emulator]]s often integrate the warnings to the desktop environment (e.g., the [[macOS]] [[Terminal (macOS)|Terminal]] will play the system warning sound) and also often offer a silent ''visual bell'' feature that flashes the terminal window briefly.
To maintain backward compatibility, video display [[computer terminal|terminal]]s (VDTs) that replaced teletypewriters included speakers or buzzers to perform the same function, as did the personal computers that followed. Modern [[terminal emulator]]s often integrate the warnings to the desktop environment (e.g., the [[macOS]] [[Terminal (macOS)|Terminal]] will play the system warning sound) and also often offer a silent ''visual bell'' feature that flashes the terminal window briefly.


== Representations ==
== Representations ==
In [[ASCII]] and [[Unicode]] the character with the value 7 is BEL. It can be referred to as control-G or {{mono|^G}} in [[caret notation]]. Unicode also includes a character for the visual representation of the bell code, "symbol for bell" (␇) at <code>U+2407</code>, not to mention <code>U+237E</code> (⍾).
In [[ASCII]] the bell character's value is 7 and is named "BELL" or "BEL". [[Unicode]] does not give names to control characters but has assigned it the alias "ALERT" and abbreviation "BEL." It can sometimes be typed as {{keypress|ctrl|G}} and displayed as {{mono|^G}} in [[caret notation]]. Unicode also includes characters for the visual representation of the character: {{unichar|2407|SYMBOL FOR BELL}} and {{unichar|237E|BELL SYMBOL}}.


In the 5-bit Baudot codes, BEL is represented by the number 11 (<code>0x0B</code>) when in "figures" mode.<ref>{{cite web|title=The Lorenz Cipher and how Bletchley Park broke it|url=http://www.codesandciphers.org.uk/lorenz/fish.htm|website=www.codesandciphers.org.uk|access-date=9 July 2016}}</ref>
In the 5-bit Baudot codes, BEL is represented by the number 11 (<code>0x0B</code>) when in "figures" mode.<ref>{{cite web|title=The Lorenz Cipher and how Bletchley Park broke it|url=http://www.codesandciphers.org.uk/lorenz/fish.htm|website=www.codesandciphers.org.uk|access-date=9 July 2016}}</ref> The code {{mono|0x2F}} is used in [[EBCDIC]].


In the programming languages [[C (programming language)|C]] (created in 1972) and [[Python (programming language)|Python]] (created in 1991), the bell character can be placed in a string or character constant with <code>\a</code>. ('a' stands for "alert" or "audible" and was chosen because <code>\b</code> was already used for the [[backspace]] character.)<ref>{{Cite web|title=2. Lexical analysis — Python 2.7.18 documentation|url=https://docs.python.org/2/reference/lexical_analysis.html#grammar-token-stringliteral|access-date=2021-02-05|website=docs.python.org}}</ref>
In the programming language [[C (programming language)|C]] (created in 1972), and in many languages influenced by it such as [[Python (programming language)|Python]], the bell character can be placed in a string or character constant with <code>\a</code>. 'a' stands for "alert" or "audible" and was chosen because <code>\b</code> was already used for the [[backspace]] character.<ref>{{Cite web|title=2. Lexical analysis — Python 2.7.18 documentation|url=https://docs.python.org/2/reference/lexical_analysis.html#grammar-token-stringliteral|access-date=2021-02-05|website=docs.python.org}}</ref>


== Usage ==
== Usage ==
Line 20: Line 22:
where the {{mono|^G}} is produced by holding down {{keypress|Ctrl}} and typing {{keypress|G}}. On Unix the user may need to type {{keypress|Ctrl}}+{{keypress|V}} first to "quote" the {{mono|^G}}.
where the {{mono|^G}} is produced by holding down {{keypress|Ctrl}} and typing {{keypress|G}}. On Unix the user may need to type {{keypress|Ctrl}}+{{keypress|V}} first to "quote" the {{mono|^G}}.


On Linux or Mac OS X one may also use:
On POSIX systems, one may also use:


echo -e "\a"
printf '\a'


and in the [[Bash (Unix shell)|Bash]] shell, one may use ANSI-C quoting:<ref>[https://www.gnu.org/software/bash/manual/bash.html#ANSI_002dC-Quoting ANSI-C quoting]</ref>
and in the [[Bash (Unix shell)|Bash]] shell, one may use ANSI-C quoting:<ref>[https://www.gnu.org/software/bash/manual/bash.html#ANSI_002dC-Quoting ANSI-C quoting]</ref>
Line 30: Line 32:
An alternative is to use the [[tput]] command, which as a part of the [[ncurses]] library is available on most Unix/Linux operating systems:
An alternative is to use the [[tput]] command, which as a part of the [[ncurses]] library is available on most Unix/Linux operating systems:


tput bel
tput bel


A program can get the same result by printing the BEL character to a terminal.
A program can get the same result by printing the BEL character to a terminal.

Latest revision as of 17:32, 25 September 2023

A bell character (sometimes bell code) is a device control code originally sent to ring a small electromechanical bell on tickers and other teleprinters and teletypewriters to alert operators at the other end of the line, often of an incoming message. Though tickers punched the bell codes into their tapes,[1] printers generally do not print a character when the bell code is received. Bell codes are usually represented by the label "BEL". They have been used since 1870 (initially in the Baudot code).[2]

To maintain backward compatibility, video display terminals (VDTs) that replaced teletypewriters included speakers or buzzers to perform the same function, as did the personal computers that followed. Modern terminal emulators often integrate the warnings to the desktop environment (e.g., the macOS Terminal will play the system warning sound) and also often offer a silent visual bell feature that flashes the terminal window briefly.

Representations

[edit]

In ASCII the bell character's value is 7 and is named "BELL" or "BEL". Unicode does not give names to control characters but has assigned it the alias "ALERT" and abbreviation "BEL." It can sometimes be typed as ctrl+G and displayed as ^G in caret notation. Unicode also includes characters for the visual representation of the character: U+2407 SYMBOL FOR BELL and U+237E BELL SYMBOL.

In the 5-bit Baudot codes, BEL is represented by the number 11 (0x0B) when in "figures" mode.[3] The code 0x2F is used in EBCDIC.

In the programming language C (created in 1972), and in many languages influenced by it such as Python, the bell character can be placed in a string or character constant with \a. 'a' stands for "alert" or "audible" and was chosen because \b was already used for the backspace character.[4]

Usage

[edit]
photograph of the keyboard for an Osborne 1 computer showing how the word "Bell" is also printed on the key for the letter "G"
Keyboard for the Osborne 1

On Unix-like systems, or on MS-DOS or Windows, a user can cause the equivalent of ringing the bell to happen by typing at the command prompt the command:

echo ^G

where the ^G is produced by holding down Ctrl and typing G. On Unix the user may need to type Ctrl+V first to "quote" the ^G.

On POSIX systems, one may also use:

printf '\a'

and in the Bash shell, one may use ANSI-C quoting:[5]

echo $'\a'

An alternative is to use the tput command, which as a part of the ncurses library is available on most Unix/Linux operating systems:

tput bel

A program can get the same result by printing the BEL character to a terminal.

On modern systems this may not make a noise; it may instead make a visual indication such as flashing the screen, or do nothing at all.

See also

[edit]

References

[edit]
  1. ^ "Baudot". Archived from the original on December 19, 2008. Retrieved February 1, 2009.
  2. ^ Smith, Gil (2001). "Teletype Communication Codes" (PDF). Baudot.net. Archived (PDF) from the original on 20 August 2008. Retrieved 2008-07-11.
  3. ^ "The Lorenz Cipher and how Bletchley Park broke it". www.codesandciphers.org.uk. Retrieved 9 July 2016.
  4. ^ "2. Lexical analysis — Python 2.7.18 documentation". docs.python.org. Retrieved 2021-02-05.
  5. ^ ANSI-C quoting