• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Unicode problem

Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm trying to send HTTP request to an sms provoder.
This request contains arabic text. The result of this arabic text is rubbish text.

Could you please advise me how can i set the unicode on my java request.
NB : I'm developping this program under Oracle Jdeveloper JDK 2 version 1.3

import java.sql.*;
import java.util.*;
import oracle.jdbc.driver.*;
import java.util.Vector;
import java.lang.String;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.*;
import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.util.Properties;
import org.w3c.dom.*;
import java.lang.Integer;
import javax.swing.JOptionPane ;
import oracle.jdeveloper.html.*;
import javax.servlet.*;
import javax.servlet.http.*;
import oracle.jdbc.driver.*;
import oracle.xml.sql.query.OracleXMLQuery;
import java.lang.*;
import Jcls_Reuters_Divers.*;


URL csoftURL = new URL("http://...");
HttpURLConnection connection = (HttpURLConnection)csoftURL.openConnection();

String postBody = "Username=" + URLEncoder.encode(SMSID) + "&" +
"PIN=" + URLEncoder.encode(SMSPIN) + "&" +
"SendTo=" + URLEncoder.encode(s_mobile) + "&" +
"Message=" + URLEncoder.encode(s_return) + "&" +
"ReplyTo=" + URLEncoder.encode(SMSREPLYTO) + "&" +


// poster les param�tres
OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream());

// Avoir les r�sultats
connection.connect(); // throws IOException
int responseCode = connection.getResponseCode(); // 200, 404, etc
String responseMsg = connection.getResponseMessage(); // OK, Forbidden, etc

BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));

String oneline = "NULL";
div.WriteLog("debut SMS ");
while ( (oneline = br.readLine()) != null) {
if (oneline.toUpperCase().indexOf("ACCEPTED") > 0)

You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic