look into bbcode or the way msn, yahoo, aim, gmail chat etc. turn character combinations into "emoticons". Depending on your language of choice you will then do a string replace on the character combos for the image it relates to when you display that text.