jQuery ajax call is not sending japanese character in headers attribute

I am using jquery.ajax call to call my service and called like

$.ajax({
        url : "my/url/for/post",
        type : 'POST',
        headers : {name:"私はガラスを食べら"},
        contentType : "application/octet-stream",
        processData : false,
        async : true,
        dataType : "json",
        success : handlers.success,
        error : handlers.error
        });

But when I check the headers in sending request, name was not there.

Is there any other attribute I have to set to send japanese or chinese character in headers?

Answers


Use name: unescape(encodeURIComponent("私はガラスを食べら") and try. encodeURIComponent() will encode special characters and unescape() will decode the encoded string.


replace content type with

contentType: "application/json; charset=utf-8",

Need Your Help

Facing error while getting value of dynamically created textbox

javascript jquery html css

i have created a dynamic textbox but unable to fetch its value on runtime. it shows something else.

Find the exact address of variable Buf

gdb buffer stack-overflow

As reference, I'm using the following code: