Re: [Xsltforms-support] Charset problem (+ bug found)
Brought to you by:
alain-couthures
From: Grégoire C. <gco...@gm...> - 2010-02-13 15:12:24
|
Ok, I found another bug in "xsltforms.js". In "XFSubmission.toUrl_", you have : if (!hasChilds && val.length > 0) { url += node.nodeName + '=' + escape(val) + separator; } but the escape() function works only with ASCII characters. So if the XForms is in UTF-8, a GET request will pass the model as ISO. Solution is to use encodeURIComponent() instead of escape() : url += node.nodeName + '=' + encodeURIComponent(val) + separator; Now the strings are encoded correctly. Regards, Grégoire Le 12 février 2010 19:14, Grégoire Colbert <gco...@gm...> a écrit : > Hi, > > I'm submitting my XForm from an UTF-8 encoded page. When the data reaches > my eXist query, and I display the parameter, it is displayed as ISO-8859-1 > on an UTF-8 page. > > BTW, looking in "xsltforms.js", I noticed that there is a missing "=" near > : > > var media = this.mediatype; > var mt = (media || "application/xml") > + (this.charset? ";charset" + this.charset : ""); > > this last line should be : > > + (this.charset? ";charset*=*" + this.charset : ""); > > However this does not solve my problem since "this.charset" is null (well > "undefined"). And even if I force UTF-8 with : > mt = "application/xml;charset=UTF-8"; > the request parameters are still converted to ISO somewhere. Any idea? > > Thanks, > Grégoire > > |