#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Problem displaying xml utf8 symbols on edittext


    i have the following project that recieve xml from the client
    but hebrew text displayed wronggly


    public void run1() {
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("my https url");

    try {
    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair("key",mykey));

    StringEntity se = new UrlEncodedFormEntity(nameValuePairs);
    httppost.setEntity(se);

    httppost.addHeader("Content-Type","application/x-www-form-urlencoded");

    ResponseHandler<String> responseHandler = new BasicResponseHandler();
    String httpResponse=httpclient.execute(httppost, responseHandler);

    //stripping from xml the info between <hebrew_val>אבגדה</hebrew_val>
    String[] separated1 = httpResponse.split("</hebrew_val>");
    String[] separated2 = separated1[0].split("<hebrew_val>");

    String finalString = URLEncoder.encode(separated2[1], "UTF-8");

    edt.setText(separated2[1]);
    Log.d("encoding", separated2[1]);
    Log.d("encoding", finalString);


    } catch (ClientProtocolException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    }

    logcat display
    01-30 15:22:36.251: D/encoding(9506): אדם שווץ
    01-30 15:22:36.251: D/encoding(9506): %C3%97%C2%90%C3%97%C2%93%C3%97%C2%9D+%C3%97%C2%97%C2%95%C3%97%C2%A8%C3%97%C2%A5

    any help appriciated
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0
    Sorry, for what program is that ?

IMN logo majestic logo threadwatch logo seochat tools logo