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 ?????..