Re: Weird Ajax non-English characters encoding problem.
Hi, This thread is a few months old now but I have the same problem now... Scandinavian characters aren't encoded and decoded in the same way when using ajax POST requests and tomcat. To me the problem seems to be that wicket does not specify the encoding in the ajax request. When tomcat receives the request and doesn't find an attached encoding, it defaults to ISO-8859-1 (in my case anyway). If I change the Content-Type header from application/x-www-form-urlencoded to application/x-www-form-urlencoded; charset=UTF-8 by patching the wicket-ajax.js file, it works for me! Did anyone find another solution to this? Nils -Opprinnelig melding- Fra: Johan Compagner [mailto:[EMAIL PROTECTED] Sendt: 22. oktober 2007 23:00 Til: users@wicket.apache.org Emne: Re: Weird Ajax non-English characters encoding problem. is this reproduceable in a simple testcase? (junit) johan On 10/22/07, Paolo Di Tommaso [EMAIL PROTECTED] wrote: I'm experiencing a similar problem i.e. I'm able to submit any Latin encoded characters but when I'm using an AjaxSubmitButton some characters are not encoded properly. This happens also specifying the right encoding with: getRequestCycleSettings().setResponseRequestEncoding(ISO-8859-1); So it appears to be clear that is an ajax encoding problem with wicket. Looking at the Wicket ajax code I found the following fragment: if (t != null) { t.open(POST, url, this.async); t.onreadystatechange = this.stateChangeCallback.bind(this); t.setRequestHeader(Content-Type, application/x-www-form-urlencoded); t.setRequestHeader(Wicket-Ajax, true); t.send(body); return true; } else { this.failure(); return false; } Now, how is defined the content encoding of an ajax request? I was expecting something like charset=defined encoding in the ajax request request header. Otherwise how the IRequestCycleSettings#setResponseRequestEncoding() will affect the charset definition in the ajax call? Thanks, Paolo On 10/22/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi Matej and Johan, thanks for your replies. I'm using Latin1 because the page I'm talking about is part of a legacy web application fully encoded in ISO-8859-1. The application server it runs on is Tomcat 5.5, which defaults to Latin1, so it shouldn't be a problem. I tried to set the request/response encoding in the application main class using: getRequestCycleSettings().setResponseRequestEncoding(ISO-8859-1); but nothing changed, except that Wicket Ajax Debug now prints: INFO: ?xml version=1.0 encoding=ISO-8859-1?ajax-response/ajax-response The problem I'm facing seems the same Stefan Lindner faced last year, whithout apparently finding a solution. I tried everything he tried. See link: http://www.nabble.com/AjaxSubmitButton-and-Umlauts-with-ISO-8859-1-%28Wicket-2%29-tf2622064.html I could migrate the whole application to UTF-8, but I would't do that for a single textarea in a single page... :-) It's the only page that needs non-English input. Any suggestion? Thanks a lot, Fabio Fioretti - WindoM On 10/21/07, Matej Knopp [EMAIL PROTECTED] wrote: I don't know tbh. I believe the request body is encoded in UTF-8. People usually use UTF-8, so no-one was complaining before. Can't you just use UTF-8? It's much safer than latin1. -Matej On 10/20/07, Johan Compagner [EMAIL PROTECTED] wrote: are you configuring wicket and you appserver correctly? in wicket you have to set the encoding you want to use why not just use utf8? else matej? How does the ajax submit work with encoding? It is still a normal post and how do we interpret it? On 10/19/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi all, thanks in advance for your time and suggestions. I'm building a really simple page made up of a form with a text area and a submit button (instance of Button). An AjaxFormSubmitBehavior that performs the save operation is added to the button. The page is encoded as follows: meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 Everything works fine until a user submits a non-English text (French or Spanish, with characters like íéñ, still supported by the ISO-8859-1 encoding): all non-English characters are scrambled. What appears weird to me is that the problem doesn't happen if I use, for example, a SubmitLink instead of an Ajax-enabled Button. This makes me point to Ajax as the responsible, and to the fact that Wicket uses UTF-8 for requests... but I really have no clue about how to fix it. Any idea? Thank you very much and have a nice week-end. Fabio Fioretti - WindoM
Re: Weird Ajax non-English characters encoding problem.
Hi Nils, in order for AJAX to work properly configure your Tomcat connector with URIEncoding=UTF-8 as shown here: http://cwiki.apache.org/WW/how-to-support-utf-8-uriencoding-with-tomcat.html Roman Nils Tesdal schrieb: Hi, This thread is a few months old now but I have the same problem now... Scandinavian characters aren't encoded and decoded in the same way when using ajax POST requests and tomcat. To me the problem seems to be that wicket does not specify the encoding in the ajax request. When tomcat receives the request and doesn't find an attached encoding, it defaults to ISO-8859-1 (in my case anyway). If I change the Content-Type header from application/x-www-form-urlencoded to application/x-www-form-urlencoded; charset=UTF-8 by patching the wicket-ajax.js file, it works for me! Did anyone find another solution to this? Nils -Opprinnelig melding- Fra: Johan Compagner [mailto:[EMAIL PROTECTED] Sendt: 22. oktober 2007 23:00 Til: users@wicket.apache.org Emne: Re: Weird Ajax non-English characters encoding problem. is this reproduceable in a simple testcase? (junit) johan On 10/22/07, Paolo Di Tommaso [EMAIL PROTECTED] wrote: I'm experiencing a similar problem i.e. I'm able to submit any Latin encoded characters but when I'm using an AjaxSubmitButton some characters are not encoded properly. This happens also specifying the right encoding with: getRequestCycleSettings().setResponseRequestEncoding(ISO-8859-1); So it appears to be clear that is an ajax encoding problem with wicket. Looking at the Wicket ajax code I found the following fragment: if (t != null) { t.open(POST, url, this.async); t.onreadystatechange = this.stateChangeCallback.bind(this); t.setRequestHeader(Content-Type, application/x-www-form-urlencoded); t.setRequestHeader(Wicket-Ajax, true); t.send(body); return true; } else { this.failure(); return false; } Now, how is defined the content encoding of an ajax request? I was expecting something like charset=defined encoding in the ajax request request header. Otherwise how the IRequestCycleSettings#setResponseRequestEncoding() will affect the charset definition in the ajax call? Thanks, Paolo On 10/22/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi Matej and Johan, thanks for your replies. I'm using Latin1 because the page I'm talking about is part of a legacy web application fully encoded in ISO-8859-1. The application server it runs on is Tomcat 5.5, which defaults to Latin1, so it shouldn't be a problem. I tried to set the request/response encoding in the application main class using: getRequestCycleSettings().setResponseRequestEncoding(ISO-8859-1); but nothing changed, except that Wicket Ajax Debug now prints: INFO: ?xml version=1.0 encoding=ISO-8859-1?ajax-response/ajax-response The problem I'm facing seems the same Stefan Lindner faced last year, whithout apparently finding a solution. I tried everything he tried. See link: http://www.nabble.com/AjaxSubmitButton-and-Umlauts-with-ISO-8859-1-%28Wicket-2%29-tf2622064.html I could migrate the whole application to UTF-8, but I would't do that for a single textarea in a single page... :-) It's the only page that needs non-English input. Any suggestion? Thanks a lot, Fabio Fioretti - WindoM On 10/21/07, Matej Knopp [EMAIL PROTECTED] wrote: I don't know tbh. I believe the request body is encoded in UTF-8. People usually use UTF-8, so no-one was complaining before. Can't you just use UTF-8? It's much safer than latin1. -Matej On 10/20/07, Johan Compagner [EMAIL PROTECTED] wrote: are you configuring wicket and you appserver correctly? in wicket you have to set the encoding you want to use why not just use utf8? else matej? How does the ajax submit work with encoding? It is still a normal post and how do we interpret it? On 10/19/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi all, thanks in advance for your time and suggestions. I'm building a really simple page made up of a form with a text area and a submit button (instance of Button). An AjaxFormSubmitBehavior that performs the save operation is added to the button. The page is encoded as follows: meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 Everything works fine until a user submits a non-English text (French or Spanish, with characters like íéñ, still supported by the ISO-8859-1 encoding): all non-English characters are scrambled. What appears weird to me is that the problem doesn't happen if I use, for example, a SubmitLink instead of an Ajax-enabled Button. This makes me point to Ajax as the responsible, and to the fact that Wicket uses UTF-8 for requests... but I
Re: Weird Ajax non-English characters encoding problem.
Hi Matej and Johan, thanks for your replies. I'm using Latin1 because the page I'm talking about is part of a legacy web application fully encoded in ISO-8859-1. The application server it runs on is Tomcat 5.5, which defaults to Latin1, so it shouldn't be a problem. I tried to set the request/response encoding in the application main class using: getRequestCycleSettings().setResponseRequestEncoding(ISO-8859-1); but nothing changed, except that Wicket Ajax Debug now prints: INFO: ?xml version=1.0 encoding=ISO-8859-1?ajax-response/ajax-response The problem I'm facing seems the same Stefan Lindner faced last year, whithout apparently finding a solution. I tried everything he tried. See link: http://www.nabble.com/AjaxSubmitButton-and-Umlauts-with-ISO-8859-1-%28Wicket-2%29-tf2622064.html I could migrate the whole application to UTF-8, but I would't do that for a single textarea in a single page... :-) It's the only page that needs non-English input. Any suggestion? Thanks a lot, Fabio Fioretti - WindoM On 10/21/07, Matej Knopp [EMAIL PROTECTED] wrote: I don't know tbh. I believe the request body is encoded in UTF-8. People usually use UTF-8, so no-one was complaining before. Can't you just use UTF-8? It's much safer than latin1. -Matej On 10/20/07, Johan Compagner [EMAIL PROTECTED] wrote: are you configuring wicket and you appserver correctly? in wicket you have to set the encoding you want to use why not just use utf8? else matej? How does the ajax submit work with encoding? It is still a normal post and how do we interpret it? On 10/19/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi all, thanks in advance for your time and suggestions. I'm building a really simple page made up of a form with a text area and a submit button (instance of Button). An AjaxFormSubmitBehavior that performs the save operation is added to the button. The page is encoded as follows: meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 Everything works fine until a user submits a non-English text (French or Spanish, with characters like íéñ, still supported by the ISO-8859-1 encoding): all non-English characters are scrambled. What appears weird to me is that the problem doesn't happen if I use, for example, a SubmitLink instead of an Ajax-enabled Button. This makes me point to Ajax as the responsible, and to the fact that Wicket uses UTF-8 for requests... but I really have no clue about how to fix it. Any idea? Thank you very much and have a nice week-end. Fabio Fioretti - WindoM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Weird Ajax non-English characters encoding problem.
I'm experiencing a similar problem i.e. I'm able to submit any Latin encoded characters but when I'm using an AjaxSubmitButton some characters are not encoded properly. This happens also specifying the right encoding with: getRequestCycleSettings().setResponseRequestEncoding(ISO-8859-1); So it appears to be clear that is an ajax encoding problem with wicket. Looking at the Wicket ajax code I found the following fragment: if (t != null) { t.open(POST, url, this.async); t.onreadystatechange = this.stateChangeCallback.bind(this); t.setRequestHeader(Content-Type, application/x-www-form-urlencoded); t.setRequestHeader(Wicket-Ajax, true); t.send(body); return true; } else { this.failure(); return false; } Now, how is defined the content encoding of an ajax request? I was expecting something like charset=defined encoding in the ajax request request header. Otherwise how the IRequestCycleSettings#setResponseRequestEncoding() will affect the charset definition in the ajax call? Thanks, Paolo On 10/22/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi Matej and Johan, thanks for your replies. I'm using Latin1 because the page I'm talking about is part of a legacy web application fully encoded in ISO-8859-1. The application server it runs on is Tomcat 5.5, which defaults to Latin1, so it shouldn't be a problem. I tried to set the request/response encoding in the application main class using: getRequestCycleSettings().setResponseRequestEncoding(ISO-8859-1); but nothing changed, except that Wicket Ajax Debug now prints: INFO: ?xml version=1.0 encoding=ISO-8859-1?ajax-response/ajax-response The problem I'm facing seems the same Stefan Lindner faced last year, whithout apparently finding a solution. I tried everything he tried. See link: http://www.nabble.com/AjaxSubmitButton-and-Umlauts-with-ISO-8859-1-%28Wicket-2%29-tf2622064.html I could migrate the whole application to UTF-8, but I would't do that for a single textarea in a single page... :-) It's the only page that needs non-English input. Any suggestion? Thanks a lot, Fabio Fioretti - WindoM On 10/21/07, Matej Knopp [EMAIL PROTECTED] wrote: I don't know tbh. I believe the request body is encoded in UTF-8. People usually use UTF-8, so no-one was complaining before. Can't you just use UTF-8? It's much safer than latin1. -Matej On 10/20/07, Johan Compagner [EMAIL PROTECTED] wrote: are you configuring wicket and you appserver correctly? in wicket you have to set the encoding you want to use why not just use utf8? else matej? How does the ajax submit work with encoding? It is still a normal post and how do we interpret it? On 10/19/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi all, thanks in advance for your time and suggestions. I'm building a really simple page made up of a form with a text area and a submit button (instance of Button). An AjaxFormSubmitBehavior that performs the save operation is added to the button. The page is encoded as follows: meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 Everything works fine until a user submits a non-English text (French or Spanish, with characters like íéñ, still supported by the ISO-8859-1 encoding): all non-English characters are scrambled. What appears weird to me is that the problem doesn't happen if I use, for example, a SubmitLink instead of an Ajax-enabled Button. This makes me point to Ajax as the responsible, and to the fact that Wicket uses UTF-8 for requests... but I really have no clue about how to fix it. Any idea? Thank you very much and have a nice week-end. Fabio Fioretti - WindoM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Weird Ajax non-English characters encoding problem.
is this reproduceable in a simple testcase? (junit) johan On 10/22/07, Paolo Di Tommaso [EMAIL PROTECTED] wrote: I'm experiencing a similar problem i.e. I'm able to submit any Latin encoded characters but when I'm using an AjaxSubmitButton some characters are not encoded properly. This happens also specifying the right encoding with: getRequestCycleSettings().setResponseRequestEncoding(ISO-8859-1); So it appears to be clear that is an ajax encoding problem with wicket. Looking at the Wicket ajax code I found the following fragment: if (t != null) { t.open(POST, url, this.async); t.onreadystatechange = this.stateChangeCallback.bind(this); t.setRequestHeader(Content-Type, application/x-www-form-urlencoded); t.setRequestHeader(Wicket-Ajax, true); t.send(body); return true; } else { this.failure(); return false; } Now, how is defined the content encoding of an ajax request? I was expecting something like charset=defined encoding in the ajax request request header. Otherwise how the IRequestCycleSettings#setResponseRequestEncoding() will affect the charset definition in the ajax call? Thanks, Paolo On 10/22/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi Matej and Johan, thanks for your replies. I'm using Latin1 because the page I'm talking about is part of a legacy web application fully encoded in ISO-8859-1. The application server it runs on is Tomcat 5.5, which defaults to Latin1, so it shouldn't be a problem. I tried to set the request/response encoding in the application main class using: getRequestCycleSettings().setResponseRequestEncoding(ISO-8859-1); but nothing changed, except that Wicket Ajax Debug now prints: INFO: ?xml version=1.0 encoding=ISO-8859-1?ajax-response/ajax-response The problem I'm facing seems the same Stefan Lindner faced last year, whithout apparently finding a solution. I tried everything he tried. See link: http://www.nabble.com/AjaxSubmitButton-and-Umlauts-with-ISO-8859-1-%28Wicket-2%29-tf2622064.html I could migrate the whole application to UTF-8, but I would't do that for a single textarea in a single page... :-) It's the only page that needs non-English input. Any suggestion? Thanks a lot, Fabio Fioretti - WindoM On 10/21/07, Matej Knopp [EMAIL PROTECTED] wrote: I don't know tbh. I believe the request body is encoded in UTF-8. People usually use UTF-8, so no-one was complaining before. Can't you just use UTF-8? It's much safer than latin1. -Matej On 10/20/07, Johan Compagner [EMAIL PROTECTED] wrote: are you configuring wicket and you appserver correctly? in wicket you have to set the encoding you want to use why not just use utf8? else matej? How does the ajax submit work with encoding? It is still a normal post and how do we interpret it? On 10/19/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi all, thanks in advance for your time and suggestions. I'm building a really simple page made up of a form with a text area and a submit button (instance of Button). An AjaxFormSubmitBehavior that performs the save operation is added to the button. The page is encoded as follows: meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 Everything works fine until a user submits a non-English text (French or Spanish, with characters like íéñ, still supported by the ISO-8859-1 encoding): all non-English characters are scrambled. What appears weird to me is that the problem doesn't happen if I use, for example, a SubmitLink instead of an Ajax-enabled Button. This makes me point to Ajax as the responsible, and to the fact that Wicket uses UTF-8 for requests... but I really have no clue about how to fix it. Any idea? Thank you very much and have a nice week-end. Fabio Fioretti - WindoM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Weird Ajax non-English characters encoding problem.
I don't know tbh. I believe the request body is encoded in UTF-8. People usually use UTF-8, so no-one was complaining before. Can't you just use UTF-8? It's much safer than latin1. -Matej On 10/20/07, Johan Compagner [EMAIL PROTECTED] wrote: are you configuring wicket and you appserver correctly? in wicket you have to set the encoding you want to use why not just use utf8? else matej? How does the ajax submit work with encoding? It is still a normal post and how do we interpret it? On 10/19/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi all, thanks in advance for your time and suggestions. I'm building a really simple page made up of a form with a text area and a submit button (instance of Button). An AjaxFormSubmitBehavior that performs the save operation is added to the button. The page is encoded as follows: meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 Everything works fine until a user submits a non-English text (French or Spanish, with characters like íéñ, still supported by the ISO-8859-1 encoding): all non-English characters are scrambled. What appears weird to me is that the problem doesn't happen if I use, for example, a SubmitLink instead of an Ajax-enabled Button. This makes me point to Ajax as the responsible, and to the fact that Wicket uses UTF-8 for requests... but I really have no clue about how to fix it. Any idea? Thank you very much and have a nice week-end. Fabio Fioretti - WindoM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Weird Ajax non-English characters encoding problem.
are you configuring wicket and you appserver correctly? in wicket you have to set the encoding you want to use why not just use utf8? else matej? How does the ajax submit work with encoding? It is still a normal post and how do we interpret it? On 10/19/07, Fabio Fioretti [EMAIL PROTECTED] wrote: Hi all, thanks in advance for your time and suggestions. I'm building a really simple page made up of a form with a text area and a submit button (instance of Button). An AjaxFormSubmitBehavior that performs the save operation is added to the button. The page is encoded as follows: meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 Everything works fine until a user submits a non-English text (French or Spanish, with characters like íéñ, still supported by the ISO-8859-1 encoding): all non-English characters are scrambled. What appears weird to me is that the problem doesn't happen if I use, for example, a SubmitLink instead of an Ajax-enabled Button. This makes me point to Ajax as the responsible, and to the fact that Wicket uses UTF-8 for requests... but I really have no clue about how to fix it. Any idea? Thank you very much and have a nice week-end. Fabio Fioretti - WindoM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Weird Ajax non-English characters encoding problem.
PS: I'm using Wicket 1.2.6. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Weird Ajax non-English characters encoding problem.
Hi all, thanks in advance for your time and suggestions. I'm building a really simple page made up of a form with a text area and a submit button (instance of Button). An AjaxFormSubmitBehavior that performs the save operation is added to the button. The page is encoded as follows: meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 Everything works fine until a user submits a non-English text (French or Spanish, with characters like íéñ, still supported by the ISO-8859-1 encoding): all non-English characters are scrambled. What appears weird to me is that the problem doesn't happen if I use, for example, a SubmitLink instead of an Ajax-enabled Button. This makes me point to Ajax as the responsible, and to the fact that Wicket uses UTF-8 for requests... but I really have no clue about how to fix it. Any idea? Thank you very much and have a nice week-end. Fabio Fioretti - WindoM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]