0

URL を渡したときに URI と URL について質問がありますが、結果は最悪です。助けが必要です!!

私のコードは次のようになります。

import java.io.*;
import java.net.*;
import java.net.URL;

public class isms {
    public static void main(String[] args) throws Exception {
        try {


       String user = new String ("boo");
       String pass = new String ("boo");
       String dstno = new String("60164038811"); //You are going compose a message to this destination number.
       String msg = new String("你的哈达哈达!"); //Your message over here
       int type = 2; //for unicode change to 2, normal will the 1.
       String sendid = new String("isms"); //Malaysia does not support sender id yet.

            // Send data
            URI myUrl = new URI("http://www.isms.com.my/isms_send.php?un=" + user + "&pwd=" + pass 
                + "&dstno=" + dstno + "&msg=" + msg + "&type=" + type + "&sendid=" + sendid);
            URL url = new URL(myUrl.toASCIIString());

            URLConnection conn = url.openConnection();
            conn.setDoOutput(true);

            // Get the response
            BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            while ((line = rd.readLine()) != null) {
                // Print the response output...
                System.out.println(line);
            }      
            rd.close();

            System.out.println(url);
        } catch (Exception e) {
            e.printStackTrace();
        }



    }
}

Webの出力は異なります..私のJava出力では

你的哈达哈达!

しかし、私のサイトでは

ÄãµÄ¹þ´ï¹þ´ï!

ヘルプ!!

4

1 に答える 1