0

When we initialize the string in class with same value it decodes it properly.When get same string from url it is not able to decode it.We are using "UTF-8".Below is the code for doing it.Any Suggestions.

public static void main(String args[]){
  SendSMS sendSMS = new SendSMS();
  sendSMS.sendSMS("", "");

  try{
     String sms="#E0#A4#B8#E0#A5#81#E0#A4#B6#E0#A4#BF#E0#A4#B2#20";
 sms=sms.replaceAll("#","%");        
  System.out.println( URLDecoder.decode(sms,"utf8"));

  }catch(Exception e){e.printStackTrace();}

  }
}

It works properly.

 System.out.println("actural sms ="+sms);
      sms=sms.replaceAll("#","%");
   System.out.println("compared"+sms.equals("%E0%A4%B6%E0%A4%B0%E0%A4%A6%20"));
     log.info("sms before formating= ");
     log.info(sms.trim());
 System.out.println( URLDecoder.decode(sms,"utf8"));





    in.close();*/

 }catch(Exception e){
     log.error("error occured while sending message:-"+e.getMessage());
     e.printStackTrace();
     }

Here it is not working properly.The output of .equals() is true..Yet the decoder gives ?????..

1 Answer 1

1

The output of .equals() is true

No, it's not.

Yet the decoder gives ?????

For me it gives सुशिल

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.