JavaScript UTF-8 to ISO-8859-1 encoding issue
<p>I'm trying to convert a record i receive from a DB (encoded in UTF-8) that's external to my web app (ISO-8859-1 encoded). </p>

<p>My ajax script is as follows:</p>

<pre><code>$.ajax({
    url: 'ajax/get_transaction_history.php',        
    type: 'GET',
    async: false,
    timeout: 30000,
    dataType: 'JSON',                
    data: ({
        transaction_id: transaction_id
    }),
    success: function (response) {                    
        $("#table_tr_history tbody").remove();
        $("#table_tr_history thead").after("&lt;tbody&gt;&lt;/tbody&gt;");
        for (tr_change in response) {                       

            $("#table_tr_history tbody").append("&lt;tr&gt;" +
                "&lt;td style=\"width: auto;\"&gt;" + decodeURIComponent(escape(response[tr_change]['user'])) + "&lt;/td&gt;"  +
                "&lt;/tr&gt;");
        }
    }
});
</code></pre>

<p>As you can see, I have tried to make use of the <code>decodeURIComponent()</code> and <code>escape()</code> functions, but still my result is not displaying spanish characters correctly. For istance, it's displaying "IBAÿEZ" instead of the N with tilde in "IBAÑEZ", as it is stored in the DB.</p>

<p>I have not tried to change html encoding in my view, since this is data i'm receiving from an external application, which i cannot change. Moreover, the data printed on the screen is a 1-time occurence in only 1 view, being that the reason why i chose to decode it with a function and not reformulate the html.</p>

<p>Any input will be greatly appreciated, thanks!!!</p>