title: Comparing utf-8 strings in java
body: <p>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.</p>
  
  <p>How to compare strings with international strings in java ? I am using SAXParser &amp; XMLReader to read strings from xml.</p>
  
  <p>Here's the line that compares strings</p>
  
  <pre><code> String country;
   country = getXMLNodeString();
  
   if(country.equals("Côte d'Ivoire"))
   {    
  
   } 
  
    getXMLNodeString()
    {
  
    /* Get a SAXParser from the SAXPArserFactory. */  
          SAXParserFactory spf = SAXParserFactory.newInstance();
          SAXParser sp = spf.newSAXParser();
  
          /* Get the XMLReader of the SAXParser we created. */
          XMLReader xr = sp.getXMLReader();
          /* Create a new ContentHandler and apply it to the XML-Reader*/
          XmlParser xmlParser = new XmlParser();  //my class to parse xml
          xr.setContentHandler(xmlParser);  
  
          /* Parse the xml-data from our URL. */
          xr.parse(new InputSource(url.openStream()));
          /* Parsing has finished. */
  
  
         //return string here
    }
  </code></pre>