3
我想通过SMPP(JSMPP库)发送短消息iwth unicode字符。我知道数据编码必须为8。&短信长度为70个字符。但是当我尝试这些时,我会收到带有中文符号的短信。这里是我的代码:通过SMPP发送Unicode短消息
ESMClass esmClass = new ESMClass();
GeneralDataCoding coding = new GeneralDataCoding(8)
String text = "üöğçşə ƏIÖĞŞÇÜ";
String p = HexUtil.convertStringToHexString(text);
byte[] textByte = HexUtil.convertHexStringToBytes(p);
String messageId = session.submitShortMessage("CMT",TypeOfNumber.INTERNATIONAL,
NumberingPlanIndicator.UNKNOWN,"1111", TypeOfNumber.INTERNATIONAL,
NumberingPlanIndicator.UNKNOWN, "phone_number", esmClass,
(byte) 0, (byte) 1, timeFormatter.format(new Date()), null,
new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT),
(byte) 0, coding, (byte) 0, textByte);
在此之后,我收到带有中文符号的消息。哪里不对?
问题解决了。问题是HexUtil没有正确地为unicode转换字符串。对于此使用代码从这里: http://en.wikipedia.org/wiki/List_of_Unicode_characters – totali 2011-06-08 10:06:37
你可以请你自己回答这个问题,然后接受答案?另外,如果他们解决了您的问题,则需要接受以前问题的答案。 – Zecas 2012-05-16 15:37:28