English 中文(简体)
送文函
原标题:Sending arabic SMS in kannel

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,要求发送短片,但同样的问题发生。

谁对问题是什么或更好的解决办法有什么想法?

这里使用的是《刑法典》,即用来发送ms。

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.")
 

谢谢。

最佳回答

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.")

i 在我的要求中,没有发送“焦炭”参数,只发送编码参数。

问题回答

I ve made a bit of research, and I believe that if you specify coding=2 Kannel expects the message body encoded as UTF-16, at least if I understood correctly this discussion.
Also you should have a look at this document.

All you have to do is the following (kannel release 1.5): 1- Add alt-charset="UTF-8" under smsc group in your kannel configuration 2- when sending the sms مرحبا for example you have to type type the following in your sendsms command: text=مرحبا&charset=UTF-8&coding=1

Check your database using mysql command because database management tools like webmin may not recognize Arabic letters





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签