在kannel中发送阿拉伯语短信 [英] Sending arabic SMS in kannel

查看:177
本文介绍了在kannel中发送阿拉伯语短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从kannel发送阿拉伯语短信(或法语短信),它不完全获得客户端(somtimes为阿拉伯语),
在做一些分析后的值发送之间的bearebox,smsbox和smsc我发现编码错误发生在我的熊箱和smsbox之间。

I am trying to send arabic sms (or french sms) from kannel and it does not get the client end perfectly ( somtimes ?????? for arabic words), after doing some analysis on the values sent between the bearebox,smsbox and smsc i found out that the error in encoding happens between my bearbox and smsbox.

我使用 charset = utf -8& coding = 2 我的http请求发送短信,但同样的问题发生

I have used charset=utf-8&coding=2 on my http request for sending sms but the same problem occurs

有没有人知道什么是问题或更好的解决方案??

Does anyone have any idea on what is the problem or better a solution ??

这里是我用来发送短信的代码

here is the code i use to send sms

StringBuffer param = new StringBuffer()
       param.append("http://localhost:1025/cgi-bin/sendsms?")
       param.append(URLEncoder.encode("username","UTF-8")).append("=").append(URLEncoder.encode("xxx","UTF-8"))
       param.append("&").append(URLEncoder.encode("password","UTF-8")).append("=").append(URLEncoder.encode("xxxx","UTF-8"))
       param.append("&").append(URLEncoder.encode("to","UTF-8")).append("=").append(URLEncoder.encode(numTel,"UTF-8"));
       param.append("&").append(URLEncoder.encode("charset","UTF-8")).append("=").append(URLEncoder.encode("utf-8","UTF-8"))

       param.append("&").append(URLEncoder.encode("coding","UTF-8")).append("=").append(URLEncoder.encode("2","UTF-8"))
       param.append("&").append(URLEncoder.encode("text","UTF-8")).append("=").append(URLEncoder.encode(text,"UTF-8"))
       param.append("&").append(URLEncoder.encode("priority","UTF-8")).append("=").append(URLEncoder.encode(""+priority,"UTF-8"))
       param.append("&").append(URLEncoder.encode("dlr-mask","UTF-8")).append("=").append(URLEncoder.encode("31","UTF-8"))
       param.append("&").append(URLEncoder.encode("dlr-url","UTF-8")).append("=").append(URLEncoder.encode(urlString,"UTF-8"))
       try{
           URL url = new URL(param.toString())
           System.out.println("INFO : Opening connection ")
           HttpURLConnection urlconnection = (HttpURLConnection) url.openConnection()
           System.out.println("INFO : Connection openned")
           BufferedReader input = new BufferedReader( new InputStreamReader(urlconnection.getInputStream()))
           String inputLine

           while ((inputLine = input.readLine()) != null)
               aResult.append(inputLine)
           input.close()
       }catch(Exception e){
           e.printStackTrace()
           return false
       }

       System.out.println("response : "+aResult.toString())
       System.out.println("INFO : all sent disconnect.")
'

谢谢

推荐答案

我已经能够发送阿拉伯文/法语短信与这个http请求示例:

i have been able to send arabic/french sms with this http request example :

StringBuffer param = new StringBuffer()
       param.append("http://localhost:1025/cgi-bin/sendsms?")
       param.append(URLEncoder.encode("username","UTF-8")).append("=").append(URLEncoder.encode("xxx","UTF-8"))
       param.append("&").append(URLEncoder.encode("password","UTF-8")).append("=").append(URLEncoder.encode("xxxx","UTF-8"))
       param.append("&").append(URLEncoder.encode("to","UTF-8")).append("=").append(URLEncoder.encode(numTel,"UTF-8"));

       param.append("&").append(URLEncoder.encode("coding","UTF-8")).append("=").append(URLEncoder.encode("2","UTF-8"))
       param.append("&").append(URLEncoder.encode("text","UTF-8")).append("=").append(URLEncoder.encode(text,"UTF-8"))
       param.append("&").append(URLEncoder.encode("priority","UTF-8")).append("=").append(URLEncoder.encode(""+priority,"UTF-8"))
       param.append("&").append(URLEncoder.encode("dlr-mask","UTF-8")).append("=").append(URLEncoder.encode("31","UTF-8"))
       param.append("&").append(URLEncoder.encode("dlr-url","UTF-8")).append("=").append(URLEncoder.encode(urlString,"UTF-8"))
       try{
           URL url = new URL(param.toString())
           System.out.println("INFO : Opening connection ")
           HttpURLConnection urlconnection = (HttpURLConnection) url.openConnection()
           System.out.println("INFO : Connection openned")
           BufferedReader input = new BufferedReader( new InputStreamReader(urlconnection.getInputStream()))
           String inputLine

           while ((inputLine = input.readLine()) != null)
               aResult.append(inputLine)
           input.close()
       }catch(Exception e){
           e.printStackTrace()
           return false
       }

       System.out.println("response : "+aResult.toString())
       System.out.println("INFO : all sent disconnect.")

我不发送我的请求中的charset参数我只发送编码参数

i don't send the "charset" parameter in my request i only send the coding parameter

这篇关于在kannel中发送阿拉伯语短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆