Java 通过SMPP发送Unicode短信

Java 通过SMPP发送Unicode短信,java,unicode,smpp,jsmpp,Java,Unicode,Smpp,Jsmpp,我想通过SMPP(JSMPP库)发送带有unicode字符的短信。我知道数据编码必须是8,短信长度是70个字符。但是,当我尝试这一点时,我会收到带有中国符号的短信。这是我的密码: ESMClass esmClass = new ESMClass(); GeneralDataCoding coding = new GeneralDataCoding(8) String text = "üöğçşə ƏIÖĞŞÇÜ"; String p = HexUtil.convertStringToHexStr

我想通过SMPP(JSMPP库)发送带有unicode字符的短信。我知道数据编码必须是8,短信长度是70个字符。但是,当我尝试这一点时,我会收到带有中国符号的短信。这是我的密码:

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);
在这之后,我得到了带有中国符号的信息。怎么了?

应该是这样的

byte[] textByte = text.getBytes("UTF-16BE");

HexUtil
在这里是个麻烦事。

不要将字符串转换为十六进制字符串&使用此数据编码而不是:

GeneralDataCoding dataCoding = new GeneralDataCoding(false, true, MessageClass.CLASS1, Alphabet.ALPHA_UCS2);
获取字节:

byte[] textByte = text.getBytes("UTF-16BE");

此示例提供使用此字符集UCS2发送sms

问题解决了。问题是HexUtil不能正确地将字符串转换为unicode。在这里使用代码:你能自己回答这个问题,然后接受这个答案吗?此外,如果前面的问题解决了您的问题,您需要接受这些问题的答案。