b_book1.gif (162 bytes) Data - Coding systems (ASCII)

Encoding text data
- Representing special characters in ASCII

C and C++

In C or C++ the program source code is written using a word processor. So how do you tell your program that you want a control character.

Example: The hello world program:

/* hello.c */
main()
{
printf("Hello, world\n");
}

The \n indicates a Linefeed (LF) or Hex 0A.
Other valid sequences include \b (backspace,08hex), \f (formfeed, 0C hex), \t (tab, 09H)

HTML's on the Internet

When html pages communicate on the Internet they may pass a string of characters with the destination url.
The design allows for passing 0-9, A-Z (upper and lowercase), $, -, _ and +, but not other reserved characters (such as !@#?).
These are transferred using the hex values of the ASCII character preceded by the % sign. So ? becomes %3F.

For example:
URL: http://www.voyager.co.nz/~verhaart/cgi/demo.pl?field.1=Michael+Verhaart&field2=Why%3F&radio.1=on

These are used extensively when using the search engines.

Further the html pages themselves need to tell the browser when for example a carriage return is required. A <P> code tells the browser to insert a carriage return (0Dhex) and Linefeed (0Ahex).

Rich text format (RTF)

Once again to enable the transfer of files to and from dissimilar computers (as is the case for htmls), Microsoft developed the RTF file format in the first instance to transfer files from the IBM PC to the Apple platform. A standard TXT (text) file format would lose all formatting, so the RTF format enables things like font type (eg Arial), or characteristics (eg. bold) to be transferred as well.

[Rev 17/9/98] 27/4/97 © 1997-98 V/2-Com (Verhaart), P O Box 8415, Havelock North, New Zealand.