首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 电信IT应用开发 >

电信smgp3.0发短信出现乱码,该怎么解决

2012-05-21 
电信smgp3.0发短信出现乱码各位大侠,最近在做电信smgp协议下发短信功能,电信只提供了sp号,网上找了个smgp

电信smgp3.0发短信出现乱码
各位大侠,最近在做电信smgp协议下发短信功能,电信只提供了sp号,网上找了个smgp开发包和文档http://download.csdn.net/detail/s1351026/4301478里面有测试用例,当我在该开发包中测试(开发包编码为gbk)发送的短信能正常在手机上显示,将开发包改为utf-8发出的是乱码,因为我们系统是统一UTF-8,将开发包打成jar放入系统中跑在tomcat发送短信也是乱码,主要代码为一下:

Java code
SMGP3 smgp = new SMGP3();         int socketID=smgp.SMGP_Connect("124.126.119.17",8890, "test",         "test",(byte)0);// 连接正常        if (socketID > 0) {            int test_ret = smgp.SMGPActiveTest(socketID);            if (test_ret == 0) {                TSMGP_SUBMIT submit = new TSMGP_SUBMIT();                submit.cMsgType = 6;                submit.cNeedReport = 1;                submit.cPriority = 0;                submit.sServiceID = "PC2P";                submit.sFeeType = "00";                submit.sFeeCode = "0";                submit.sFixedFee = "0";                submit.sValidTime = "";                submit.sAtTime = "";                submit.sSrcTermID = "106590290015";                submit.sChargeTermID = "106590290015";                submit.sDestTermID = "15332319099"                submit.ucMsgFormat = 15;       // 设置消息体编码格式    8:ucs2,15为gbk18030                submit.sMsgContent =content;// sxit测试短信5555566";                submit.sReserve = "";                TSMGP_TLV tlv = new TSMGP_TLV();                tlv.b_cDestMaskFlag = true;                tlv.cDestMaskFlag = 1;                tlv.b_cFeeFlag = true;                tlv.cFeeFlag = 1;                tlv.b_cFeeMaskFlag = true;                tlv.cFeeMaskFlag = 1;                tlv.b_cMServiceID = true;                tlv.cMServiceID = 1;                tlv.b_cMsgType = true;                tlv.cMsgType = 1;                tlv.b_cNodesCount = true;                tlv.cNodesCount = 1;                tlv.b_cPid = true;                tlv.cPid = 1;                tlv.b_cPkNumber = true;                tlv.cPkNumber = 1;                tlv.b_cPkTotal = true;                tlv.cPkTotal = 1;                tlv.b_cSpDealResult = true;                tlv.cSpDealResult = 1;                tlv.b_cSpMaskFlag = true;                tlv.cSpMaskFlag = 1;                tlv.b_cSrcMaskFlag = true;                tlv.cSrcMaskFlag = 1;                tlv.b_cUdhi = true;                tlv.cUdhi = 1;                tlv.b_strDestNumberMask = true;                tlv.strDestNumberMask = "123";                tlv.b_strMsgSrc = true;                tlv.strMsgSrc = "测试TLV";                tlv.b_strFeeNumberMask = true;                tlv.strFeeNumberMask = "232";                tlv.b_strLinkId = true;                tlv.strLinkId = "";                tlv.b_strSrcNumberMask = true;                tlv.strSrcNumberMask = "4333435";                // submit.tsmgpTlv=tlv;                TSMGP_RESP resp = new TSMGP_RESP();                int submit_ret = smgp.SMGP_Submit(socketID, submit, resp);

请大家帮忙找茬,灰常紧急,小弟拜谢,雪地在线跪等!!!

[解决办法]
我有一个好办法,QQ聊:46415402

热点排行