Opened 14 years ago

Closed 14 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:



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?


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){




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)

ReturnedString.GIF (9.4 KB) - added by guest 14 years ago.
character with accent received with xhrPost

Download all attachments as: .zip

Change History (2)

Changed 14 years ago by guest

Attachment: ReturnedString.GIF added

character with accent received with xhrPost

comment:1 Changed 14 years ago by Adam Peller

Resolution: invalid
Status: newclosed

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.

Note: See TracTickets for help on using tickets.