Computer punctuation: Difference between revisions
imported>Ed Poor (searching for information on the web) |
imported>Ed Poor (too wordy? not for this project?) |
||
Line 10: | Line 10: | ||
then the words so enclosed must be found in precisely that sequence. | 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') |
Revision as of 12:02, 8 October 2009
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')