通过Kannel发送缅甸语

时间:2014-09-03 09:10:13

标签: sms kannel southeast-asian-languages

我正在尝试从kannel发送缅甸短信,但它没有在手机上获得正确的格式,我得到一些未知的符号或汉字而不是 任何人都可以帮助我这里是我的代码 信息:手机已经安装了缅语语言......

package com.mms.tools;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;

public class Sendx
{
public static void main(String args[]) 
{
String text = "နိိက္ငိနအထမအ ါါအအနါ ";
StringBuffer myurlx = new StringBuffer();
StringBuffer aResult = new StringBuffer();
try
{
   myurlx.append("http://127.0.0.1:13013/cgi-bin/sendsms?");
   myurlx.append(URLEncoder.encode("username","UTF-   8")).append("=").append(URLEncoder.encode("tester","UTF-8"));
   myurlx.append("&").append(URLEncoder.encode("password","UTF-8")).append("=").append(URLEncoder.encode("foobar","UTF-8"));
   myurlx.append("&").append(URLEncoder.encode("to","UTF-8")).append("=").append(URLEncoder.encode("+919096565288","UTF-8"));

   myurlx.append("&").append(URLEncoder.encode("smsc","UTF-8")).append("=").append(URLEncoder.encode("at","UTF-8"));


   myurlx.append("&").append(URLEncoder.encode("coding","UTF-8")).append("=").append(URLEncoder.encode("2","UTF-8"));
   myurlx.append("&").append(URLEncoder.encode("text","UTF-8")).append("=").append(URLEncoder.encode(text,"UTF-8"));
   myurlx.append("&").append(URLEncoder.encode("dlr-mask","UTF-8")).append("=").append(URLEncoder.encode("31","UTF-8"));
}

catch(UnsupportedEncodingException e)
{
e.printStackTrace();
}
   try
{
       URL url = new URL(myurlx.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();
    }

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

1 个答案:

答案 0 :(得分:0)

尝试添加

   myurlx.append("&").append(URLEncoder.encode("charset","UTF-8")).append("=").append(URLEncoder.encode("utf-8","UTF-8"));

添加

代码
 charset=utf-8

您网址的额外参数。