Computer punctuation

From Citizendium
Jump to navigation Jump to search
This article is a stub and thus not approved.
Main Article
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
This editable Main Article is under development and subject to a disclaimer.

Computer punctuation follows strict rules. Understanding these rules helps programmers and end users to enter information into computers and to look up information which is already in them.

Web Sites

When doing a web search (in a browser, using a search engine), entering multiple terms separated by spaces is the standard. The search engine tries to find pages which contain all the terms.

When some of the terms are enclosed in quotation marks

Reagan "trust but verify"

then the words so enclosed must be found in precisely that sequence.

Website Development

When using PHP for server side scripting, you'll find that some servers add punctuation to some user inputs. In particular, the apostrophe will often be escaped with a backslash. This behavior can be changed when PHP is initialized, but it can be easier simply to detect when it is happening.

The purpose of escaping punctuation marks such as the apostrophe is to aid the programmer who is going to store these values in a database that uses SQL (such as the popular and free MySQL database). A query string such as

INSERT INTO employee (name, telephone) VALUES ('Smith', '555-1212')

requires all text values to be enclosed in quotation marks. Usually, the single quotation mark is used, which is the same as an apostrophe. So how do you enter a name like O'Reilly?

C and Java and PHP all use the convention that a backslash in front of certain special characters causes the character to be treated differently. \n inserts a new line, and \t is a tab. Likewise, \' inserts an apostrophe.

INSERT INTO employee (name, telephone) VALUES ('O\'Reilly', '555-3456')

MySQL number fields

Unlike some databases, MySQL allows a numeric field to accept a number in quotes. If a zero-length string is submitted, the number zero is stored.