0

We are getting some special chars in java so i am doing UTF-8 encoding later i want to compare the coder string and original string.I could not able to get it how to compare in java. Could you please help me how to solve this problem.

    String name = java.net.URLEncoder.encode("Šantel", "UTF-8");
    String org = "Santel";
    System.out.println(name);
    System.out.println(name.contentEquals(org));

I want to compare name and org string this should return true.

Could you please help me..

Thanks Best Regards Vijay Kumar

Vijay Kumar
  • 81
  • 2
  • 10
  • Check out http://stackoverflow.com/q/2373213/20670 - does this answer your question? – Tim Pietzcker May 27 '14 at 08:02
  • UTF-8 encoding and URL encoding performed by `URLEncoder` are two **very** different things that serve quite different purposes. Unless you are trying to use the string as a part of URI you do not need to use `URLEncoder` at all and you should just follow the answer from [Java. Ignore accents when comparing strings](http://stackoverflow.com/questions/2373213/java-ignore-accents-when-comparing-strings?lq=1) linked above. – Oleg Estekhin May 27 '14 at 08:23

0 Answers0