title: Correctly generating a sitemap XML with special characters
body: <p>I've a program which generates XML sitemaps for Google Webmaster Tools (among other things).<br />
  GWTs is giving me errors for some sitemaps because the URLs contain character sequences like ã¾, ã‹, ã€, etc. **</p>
  <p><a href="https://www.sitemaps.org/protocol.html" rel="nofollow noreferrer">Sitemap specification says</a>:</p>
  <blockquote>
  <p>Your Sitemap file must be UTF-8 encoded (you can generally do this when you save the file). As with all XML files, any data values (including URLs) must use entity escape codes for the characters listed: <strong>&amp;</strong>, <strong>'</strong>, <strong>&quot;</strong>, <strong>&lt;</strong>, <strong>&gt;</strong>.</p>
  </blockquote>
  <p>The special characters are escaped in the XML files (with HTML entities). XML file snippet:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;urlset xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;&gt;
      &lt;url&gt;
          &lt;loc&gt;http://domain/folder/listing-&amp;#227;&amp;#129;.shtml&lt;/loc&gt;
          ...
  </code></pre>
  <p>Are my URLs UTF-8 encoded? If not, how do I do this in Java? The following is the line in my program where I add the URL to the sitemap:</p>
  <pre><code>    siteMap.addUrl(StringEscapeUtils.escapeXml(countryName+&quot;/&quot;+twoCharFile.getRelativeFileName().toLowerCase()));
  </code></pre>
  <p>I'm not sure which ones are causing the error, probably the first two examples.</p>