XMLHttpRequest Charset header problem with "special characters" and black questionmarks...

XMLHttpRequest Charset header problem with "special characters" and black questionmarks...

Hi,

if you have a look at bivakas.host-ed.net you will notice that all my special characters are just black question marks. (not this website is in Lithuanian... making it for a friend).

As far as I have researched (which has been for two days and I have now had enough..) the header needs to be altered in the "beforeSend" $.ajax part to get this to work thus I have the following code:

  1. $(document).ready(function(){
    $('.content').load('home.php'); //by default initally load text
    $('#navlist a').click(function() { //start function when any link is clicked
    $(".content").slideUp("slow");
    var content_show = $(this).attr("title"); //retrieve title of link so we can compare with php file
    $.ajax({
    method: "get",url: ""+content_show,
    beforeSend: function(){
    XMLHttpRequest.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
    $("#loading").show("fast");

    }, //show loading just when link is clicked
    complete: function(){ $("#loading").hide("fast");}, //stop showing loading when the process is complete
    success: function(html){ //so, if data is retrieved, store it in html
    $(".content").show("slow"); //animation
    $(".content").html(html); //show the html inside .content div
    //alert(document.charset);
    }
    }); //close $.ajax(
    }); //close click(
    }); //close $(




















I have tried a ridiculous amount of variations on the XMLHttpRequest.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); and none of them make a difference.

Thanks a lot for the help!!

file is also attached for convenience