Opened 13 years ago
Closed 13 years ago
#6037 closed defect (invalid)
Character Encoding in xhrPost
Reported by: | guest | Owned by: | James Burke |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | IO | Version: | 1.0 |
Keywords: | xhrPost, charset | Cc: | |
Blocked By: | Blocking: |
Description
Hello,
I am trying to receive a string with an xhrPost. The string contains characters with accents (as à , è, é).
When I put the returned string into an alert, characters like à , é aren't showing up. I set content-type using UTF-8 encoding.
I attach a screen shot of the returned string. Could you help me?
Thanks.
Here's my dojo code: ================================================================================ var sendObjId = {
url: "report.jsp.cas", handleAs: "text", content: {idReportRequest : idRep, revent : 'reportHtmlMenu', a0 : nr_row, a2 : nr_col}, contentType: "application/x-www-form-urlencoded; charset=utf-8", load: function(response,ioArgs){
alert(response);
}
};
var requestObj = dojo.xhrPost(sendObjId); ================================================================================
Here's the Java class to return the string: ================================================================================ public class ReportMenuHTMLGenerator {
public String render(ReportView? rw,String selectedRow,String selectedCol,CSSession csSession){
String menuHtml="var menuItems = [";
menuHtml += "['Main'],"; menuHtml += "['Modalità di pagamento'],"; menuHtml += "['Città Fornitore'],"; menuHtml += "];"; return menuHtml;
}
} ================================================================================
Attachments (1)
Change History (2)
Changed 13 years ago by
Attachment: | ReturnedString.GIF added |
---|
comment:1 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
You're sending your request data with UTF-8, but I don't think that has any impact on the returned content, which should be UTF-8 unless your server is setting it to something else. Have you tried using an HTTP inspector tool to check the headers? also to make sure that the content is put on the wire with the right encoding? A lot is happening between the Java code you show us an the bytes going on the wire.
Also, Dojo has an i18n mechanism that will seek and load resource bundles like this for you, without any server code. FYI.
Please take this question to the forum and we will follow up there. We can't troubleshoot in trac. Thanks.
character with accent received with xhrPost