Regarding AJAX charset

Discussion in 'JavaScript' started by vetrivel, Dec 3, 2010.

  1. #1
    Hi ,
    I have this problem for long time and i am still hunting the right answer or method to solve this.
    NOTE : **** = charset other than UTF-8

    Ajax request will have a Charset UTF-8 and
    Response Charset is **** (not UTF-8).

    Now i want to change the Request charset to **** so ,both the request and response will have the same charset. (I dont want UTF-8 ,because my php content holds **** charset).

    I have tried to Meta header ,header and even hard coded the ajax request header in the ajax call.

    But it is working in its own way.
    and i try to add this **** in accept charset and it also failed.

    Due to this problem i am getting error in IE and my entire application collapse .

    I hope alot of people have this problem ,but i dont know who will have answer to this issue .

    Awaiting for any positive response .
     
    vetrivel, Dec 3, 2010 IP
  2. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Add this to your ajax call replacing with the proper charset :
    $.ajax({
            data: parameters,
            type: "POST",
            url: ajax_url,
            timeout: 20000,
            contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15", <-----
            dataType: 'json',
            success: callback
    });
    HTML:
     
    tvoodoo, Dec 4, 2010 IP
  3. vetrivel

    vetrivel Peon

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi ,
    i have tried that too ,It didn't reflect that charset ,it still send as utf-8 only.
     
    vetrivel, Dec 9, 2010 IP