encoder for SMS messages in PDU format

Encoding text messages in PDU format is needed if you want to get an Arduino board to send SMS messages through a GSM modem which does not understand text format. This is the case for many (very cheap) older cell phones which have a built-in modem and a serial interface and are easy to connect to Arduino.
There is a library "Pduencoder" on the playground but I couldn't get it to work with the Arduino 22 IDE. So I decided to try to write a new code on my own. Finally I succeeded and - happy about the result - I thought I could write a short tutorial about this subject, before the details behind this code would fade again from my memory.
I released it in the playground under Interfacing With Hardwarewhere/Communication in the GSM/GPRS section: "Another PDU encoder"