firebug - Dojo dijit.form.Select corrupting european characters in Firefox -


i have dropdown defined dojotype="dijit.form.select" id="mydropdown"

i load json array follows

    dojo.xhrget({         url: "getoptions",         handleas: "json",         preventcache : true,         timeout : 50000,         load : function(data, ioargs) {               var options = data.options;               mystore.data = options               dijit.byid("mydropdown").setstore("mystore")               ... 

where mystore = new dojo.data.itemfilereadstore({})

here json comes server:

{"options":{"items":[...,{"name":"crédit","id":57},...]}} 

when mydropdown rendered in firefox character é becomes �. works fine in ie9 , chrome 26.

what strange same character rendered correctly in firefox dojox.grid.datagrid.

also if load json directly firefox putting getoptions address, json showing correct characters. when check result of dojo.xhrget() in firebug see same json corrupted character. appears dojo.xhrget() causing corruption. why showing correctly datagrid loaded using dojo.xhrget()?

it's because somewhere mixes multiple character encodings (for example utf-8 , characterset). had similar issue once opera using encoding expected.

to solve should check several things.

you should verify if getoptions url sends data propert headers. use developer tools/firebug (usually f12) verify headers sent , content-type is.

then should verify if current page encoded same characterset. think browsers use default if xhr request not tell them charset should used. should checking headers (similar previous step) and checking <header> tag similar this:

<meta http-equiv="content-type" content="text/html; charset=utf-8"> 

you can try enforcing characterset of xhr call following property:

headers: { "content-type": "application/json; charset=utf-8" }, 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -