try { switch (theAlphabet) { case SmsConstants.ALPHABET_GSM:  setDataCodingScheme(SmsConstants.DCS_DEFAULT_7BIT); setContent(null, SmsPduUtil.getSeptets(theMsg), theMsg.length()); break; case SmsConstants.ALPHABET_8BIT:  setDataCodingScheme(SmsConstants.DCS_DEFAULT_8BIT); setContent(null, theMsg.getBytes("ISO-8859-1"), theMsg.length()); break; case SmsConstants.ALPHABET_UCS2:  setDataCodingScheme(SmsConstants.DCS_DEFAULT_UCS2); setContent(null, theMsg.getBytes("UTF-16BE"), theMsg.length() * 2); break; } } catch (UnsupportedEncodingException ex) {    throw new RuntimeException(ex.getMessage()); }
this(theMsg, theAlphabet); int dcs = getDataCodingScheme() | 0x10 | theMessageClass; setDataCodingScheme((byte)(dcs & 0xff));
    public SmsTextMessage(String theMsg, int theAlphabet)    {        try        {            switch (theAlphabet)            {            case SmsConstants.ALPHABET_GSM:                // 7-bit encoding, No message class, No compression                setDataCodingScheme(SmsConstants.DCS_DEFAULT_7BIT);                setContent(null, SmsPduUtil.getSeptets(theMsg), theMsg.length());                break;            case SmsConstants.ALPHABET_8BIT:                // 8bit data encoding, No message class, No compression                setDataCodingScheme(SmsConstants.DCS_DEFAULT_8BIT);                setContent(null, theMsg.getBytes("ISO-8859-1"), theMsg.length());                break;            case SmsConstants.ALPHABET_UCS2:                // 16 bit UCS2 encoding, No message class, No compression                setDataCodingScheme(SmsConstants.DCS_DEFAULT_UCS2);                setContent(null, theMsg.getBytes("UTF-16BE"), theMsg.length() * 2);                break;            }        }        catch (UnsupportedEncodingException ex)        {            // Shouldn't happen. According to the javadoc documentation            // for JDK 1.3.1 the "UTF-16BE" and "ISO-8859-1" encoding            // are standard...            throw new RuntimeException(ex.getMessage());        }    }