Comparing utf-8 strings in java

Posted by cppdev on Stack Overflow See other posts from Stack Overflow or by cppdev
Published on 2010-05-08T02:56:11Z Indexed on 2010/05/08 2:58 UTC
Read the original article Hit count: 280

Filed under:

Hi,

In my java program, I am retrieving some data from xml. This xml has few international characters and is encoded in utf8. Now I read this xml using xml parser. Once I retrieve a particular international string from xml parser, I need to compare it with set of predefined strings. Problem is when i use string.equals on internatinal string comparison fails.

How to compare strings with internatinal strins in java ?

Here's the line that compares strings

string country;

if(country.equals("Côte d'Ivoire")) {

}

© Stack Overflow or respective owner

Related posts about java