×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    1

    Question J2ME Arabic name in URL Encoding problem...

    J2ME and NetBeans

    I'm talking with php page which tooks the parameters by GET and return the result as xml file which I read in my mobile application to get the result. (something like ajax)

    the problem is that I send in the url some arabic names, like this:

    http://www.mywebsite.com/index.php?name=اسدالقدس
    but when I send it it becomes like
    http://www.mywebsite.com/index.php?name=????????
    Code:
    String url="http://www.xxxxx.com/index.php?name=اسدالقدس";
    url = new String(url.getBytes("utf-8"),"utf-8");
    HttpConnection httpConnection = (HttpConnection) Connector.open(new String());
    KXmlParser parser = new KXmlParser();
    parser.setInput(new InputStreamReader(httpConnection.openInputStream(), "UTF-8"));
    parser.nextTag();
    parser.require(XmlPullParser.START_TAG, null, rootTag);
    All my attempts failed...
    the parameter entered in the database like this ????

    any help would be greatly appreciated.

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: J2ME Arabic name in URL Encoding problem...

    Hi LionAlquds and welcome to Nokia's Discussion Boards,

    That is most likely because you are not properly URL Encoding the Arabic text. Your url String contains already your parameter in this form ???????? before you send it over to the server. You need to properly URL Encode (percentage encoding) the Arabic parameter so that your url String looks like this:

    xxxxx.com/index.php?name=%D8%A7%D8%B3%D8%AF%D8%A7%D9%84%D9%82%D8%AF%D8%B3

    A web based URL Encoder/Decoder can be found here.

    From what I see, the LWUIT library provides the encodeUrl method as part of the com.sun.lwuit.io.util.Util class. You could try that method to encode your string, or implement your own method for URL Encoding.
    Last edited by skalogir; 2012-05-08 at 12:53.

Similar Threads

  1. Send Arabic SMS from J2ME
    By grayess in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2010-08-03, 10:45
  2. displaying arabic using j2me
    By raghda in forum Mobile Java General
    Replies: 16
    Last Post: 2009-06-18, 13:03
  3. how can i display a text in arabic through j2me
    By arun09 in forum Mobile Java General
    Replies: 3
    Last Post: 2009-06-08, 15:36
  4. my j2me has aproblem with arabic!!!
    By nmostafa in forum Mobile Java General
    Replies: 18
    Last Post: 2009-05-22, 08:29
  5. j2me send sms encoding problem!
    By danielwang99 in forum Mobile Java General
    Replies: 4
    Last Post: 2008-05-09, 02:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •