Neat Programming #4

Printing symbols and other weird characters.

I know this is not really a neat programming trick, but I have included this topic as it can be quite frustrating trying to figure out how to print some of the more unusual characters.

I will list the greek letters and the codes to print these. Mathematical symbols. Some of the characters that print from the standard ASCii character set, like code 153 (™) and ♣.

All of the following characters can be displayed in HTML using a name preceeded by an ampersand (&);

First, let's learn the Greek alphabet.

Alpha - Beta - Gamma - Delta - Epsilon - Zeta - Eta - Theta - Iota - Kappa - Lambda - Mu - Nu - Xi - Omicron - Pi - Rho - Sigmaf - Sigma - Tau - Upsilon - Phi - Chi - Psi - Omega

Each of these Greek letters can be printed on screen using its name preceeded by an ampersand and followed by a semi-colon, so the sigma character that we use in maths for 'sum' can be printed to screen using Σ. This will show the capital letter Sigma Σ. The lower case sigma is printed to screen using the same code but with a lower case first letter, like so; σ σ

The only one that does not seem to be able to be used is 'Sigmaf'. Each Greek character can also be displayed using the character set code. The code for the Greek letter before Sigmaf, which is Rho (Ρ) is &#929 and the code for the letter after Sigmaf, which is Sigma (Σ) is &#931, so you would think that code in between these two (930) would print the Greek letter Sigmaf, but it does not display using either the code (&930; which just displays ΢) or the name (&Sigmaf; which doesn't do anything). This letter does seem to have been defined in the HTML character sets.

However, you can use the lower-case sigmaf (ς), using the code 962 or the name with a lower-case first letter.

In addition to the 25 upper and lower-case letters of the greek alphabet, you can also use the Theta, Upsilon and Pi symbols. The words for these are;

Symbols
theta - ϑ - ϑ
upsilon - ϒ - ϒ
pi - ϖ - ϖ

Compare these to the upper and lower-case letters.

Upper-case
Theta - Θ - Θ
Upsilon - Υ - Υ
Pi - Π - Π

Lower-case
theta - θ - θ
upsilon - υ - υ
pi - π - π

Earlier, I mentioned that each Greek letter and the 3 extra sybmbols, have a character set code The codes run from 913 to 937 for the upper-case letters, not inlcuding 930, as Sigmaf does not work, remember. From 945 to 969 for the lower-case letter and the symbols are 977, 978 & 982 respectively.

Now you may well ask, "So what are all the numbers inbetween these ranges". I thought the same thing. So let us take a look.

Ϊ prints Ϊ. This looks like a larger version of the lower-case i with an umlaut, which is displayed using the code 239 (&239; - ï) or the word iuml (ï - ï)

Ϋ prints Ϋ

ά prints ά

έ prints έ

ή prints ή

ί prints ί

ΰ prints ΰ

ϊ prints ϊ

ϋ prints ϋ

ό prints ό

ύ prints ύ

ώ prints ώ

Ϗ prints Ϗ. This small square mean that the code is not defined in any HTML character set.

ϐ prints ϐ. This is similar to the German small sharp s, which is displayed using the code 223 (&223; - ß) or the word szlig (ß - ß)

So, as you can see, there are a lot of code that produce a myriad of different characters and symbols.

Although the ISO 8859-1 is the default character set in most browsers, most modern browsers will also support the ASCii characters set and the greek characters, as above.

The ASCii character set uses the codes from 0 to 255. HTML supports codes from 32 to 126 as the printable characters. See the table below

ASCii codeCharacterASCii codeCharacter
32Space33!
34"35#
36$37%
38&39'
40(41)
42*43+
44,45-
46.47/
480491
502513
524535
546557
568579
58:59;
60<61=
62>63?
64@65A
66B67C
68D69E
70F71G
72H73I
74J75K
76L77M
78N79O
80P81Q
82R83S
84T85U
86V87W
88X89Y
90Z91[
92\93]
94^95_
96`97a
98b99c
100d101e
102f103g
104h105i
106j107k
108l109m
110n111o
112p113q
114r115s
116t117u
118v119w
120x121y
122z123{
124|125}
126~
  • All pictures displayed on this site were taken by or are fully owned by me.
  • This site has been upgraded to use HTML5 and should be backward compatible with older browsers. If you think any pages are not displaying correctly contact the site author here.
  • This site uses Java script to maintain compatibility. To view this site correctly, you should allow scripts and ActiveX controls to run.
  • If you don't feel easy or competent changing the security settings and you are willing to trust that my site is not going to harm your computer, then add my site to your trusted sites zone. To stop the Script and ActiveX controls prompt from appearing everytime you access this page, you should also tick the option to 'Allow active content to run in files on My Computer' in the security section of the security tab of the Internet Options dialog box. This can be accessed from the tools menu or the cog to the right of the address bar.
  • Although I have upgraded this site to support the new HTML5, I am still a learner myself. If you have any tips you would like to share with me and the visitors to this site, I will gladly add your contributions to the contributions pages.
  • This site is ranked on URLmetrics

copyright 2012-2013 Stephen Edgington.