Add correct message length handling in GSM and Unicode encodings