How to fix the "charset" of an XML document?

1

I have this code

$.ajax({
    url: "https://crossorigin.me/http://www.acidigital.com/rss/rss_santo.php",
    crossDomain: true,
    contentType: "application/xml; charset:utf-8",
    type: "GET",
    dataType: "xml",
    success: function (re) {

        console.log(re) // documento XML puro

    }
})

It turns out that the XML document for this request ( link ) comes with the special characters replaced by " ".

    
asked by anonymous 04.08.2016 / 17:46

1 answer

1

Here is the sample code:

$.ajax({
    url: "https://crossorigin.me/http://www.acidigital.com/rss/rss_santo.php",
    crossDomain: true,
    contentType: "application/xml; charset:ISO-8859-1",
    type: "GET",
    beforeSend: function(charset) {
        charset.overrideMimeType('text/html; charset=iso-8859-1');
    },
    success: function (re) {
      xmltemp = $.parseXML(re);
      $texto = $(xmltemp).find('description');
      console.log($texto.text());
    }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script><pre></pre>

ReadaboutXmlHttpRequesthasconversion/manipulation:

link

even more

    
04.08.2016 / 18:24