Hello,<div><br class="webkit-block-placeholder"></div><div> I want to make an HTTP GET request to a URL that returns an XML document, which I'd then like to run an XPath query against, but when I run it, all I get is a list of integers when I output the response body. I think this is due to the charset being in UTF-8. When I run the same program against <a href="http://slashdot.org">http://slashdot.org</a>, I get back the html content from slashdot in a readable form, and I think it's because slashdot uses iso-8859-1 as it's charset. How can I run XPath against what is returned when the page uses UTF-8? And how can I print UTF-8 to the console, so I can actually read it? Here is the small script I've written:</div>
<div><br class="webkit-block-placeholder"></div><div><div>-module(tmp).</div><div>-export([get_url/0]).</div><div><br class="webkit-block-placeholder"></div><div>get_url() -></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>{_,{_, Header, Body}} = http:request("<a href="http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&should-sponge=&query=PREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+dbpedia2%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fproperty%2F%3E%0D%0A%0D%0ASELECT+*+WHERE+%7B%0D%0A%3Fsubject+rdf%3Atype+%3Chttp%3A%2F%2Fdbpedia.org%2Fclass%2Fyago%2FCity108524735%3E.%0D%0A%3Fsubject+rdfs%3Alabel+%3Flabel.%0D%0A%3Fsubject+dbpedia2%3Apopulation+%3Fpopulation.%0D%0AFILTER+%28lang%28%3Flabel%29+%3D+%22en%22+%26%26+xsd%3Ainteger%28%3Fpopulation%29+%3E+200000%29%0D%0A%7D&format=application%2Fsparql-results+xml&debug=on">http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&should-sponge=&query=PREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+dbpedia2%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fproperty%2F%3E%0D%0A%0D%0ASELECT+*+WHERE+%7B%0D%0A%3Fsubject+rdf%3Atype+%3Chttp%3A%2F%2Fdbpedia.org%2Fclass%2Fyago%2FCity108524735%3E.%0D%0A%3Fsubject+rdfs%3Alabel+%3Flabel.%0D%0A%3Fsubject+dbpedia2%3Apopulation+%3Fpopulation.%0D%0AFILTER+%28lang%28%3Flabel%29+%3D+%22en%22+%26%26+xsd%3Ainteger%28%3Fpopulation%29+%3E+200000%29%0D%0A%7D&format=application%2Fsparql-results+xml&debug=on</a>"),</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>Body.</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>I appreciate any help. Thanks,</div><div>Dustin</div>
</div>