Re: [Wicket-user] The problem about encoding and event in ajax
(weird, I sent mail two days ago, but it is rejected. I send again)anyway, I found that Ajax request are all encoded as UTF-8 no matter what encoding used in the web page. And Tomcat always re-encode ajax request to ISO8859-1 (don't known why...) so I need to recover encoding back to UTF-8 manually for all request parameters: new String(parameter.getBytes(ISO8859-1), UTF-8);To solve this gloably I use a ServletFilter:public class FixAjaxEncodingFilter extends Filter { private static final String WICKET_AJAX = Wicket-Ajax; @Override protected void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws ServletException, IOException { //Skip some casting... String wicketAjaxHeader = request.getHeader(WICKET_AJAX); if (wicketAjaxHeader == null || wicketAjaxHeader.trim().length() == 0) { filterChain.doFilter(request, response); } else { filterChain.doFilter(new AjaxEncodingFixHttpServletRequest( request), response); } } /** * The request wrapper to fix ajax request encoding for encoding other than * UTF-8 */ private static class AjaxEncodingFixHttpServletRequest extends HttpServletRequestWrapper { private final HashMapString, Object encodedParameterMap; @SuppressWarnings(unchecked) public AjaxEncodingFixHttpServletRequest( final HttpServletRequest orgHttpServletRequest) { super(orgHttpServletRequest); encodedParameterMap = new HashMapString, Object(); final MapString, Object orgParameterMap = getRequest() .getParameterMap(); for ( Map.Entry String, Object entry : orgParameterMap.entrySet()) { if (entry.getValue() == null) { encodedParameterMap.put(entry.getKey(), entry.getValue()); continue; } try { if (entry.getValue().getClass().isArray()) { String[] values = (String[]) entry.getValue(); String[] newValues = new String[ values.length]; for (int i = 0; i values.length; i++) { if (values[i] == null) { continue; } newValues[i] = new String(values[i] .getBytes(ISO8859-1), UTF-8); } encodedParameterMap.put (entry.getKey(), newValues); } else { String value = (String) entry.getValue(); encodedParameterMap.put(entry.getKey(), new String( value.getBytes(ISO8859-1), UTF-8)); } } catch (UnsupportedEncodingException e) { throw new RuntimeException(unexpected, e); } } } @Override public Map getParameterMap() { return encodedParameterMap; } @Override public String getParameter(String name) { Object object = encodedParameterMap.get(name); if (object == null) return null; if (object.getClass().isArray()) { String[] values = (String[]) object; if ( values.length == 0) return null; return values[0]; } else { return object.toString(); } } @Override public String[] getParameterValues(String name) { Object object = encodedParameterMap.get(name); if (object == null) return null; if (object.getClass().isArray()) { return (String[]) object; } else { return new String[] { object.toString() }; } } }}If request is Wicket Ajax, then wrap original HttpSerlvetRequest and re-encode all request parameters. This filter also solve get problems such as AjaxEditableLabel, which originally requiring additional seeting on URIEncoding . Don't know if there is any Native Wicket way to solve this ?-- Ingram ChenJava [EMAIL PROTECTED]Institue of BioMedical Sciences Academia Sinica Taiwanblog: http://www.javaworld.com.tw/roller/page/ingramchen - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
sorry.. I don't exactly understand what you mean, do you mean browser's charactor encoding mode ? if so, my browser's Charactor Encoding switch to Big5 when request set to Big5.anyway, I just create a quickstart with encoding cp866, a Russian encoding. I can't read Runssian, either. but it should be enough to demo the problem. please see attachement. In quickstart I do :(1) set QuickStartApplication: getMarkupSettings().setDefaultMarkupEncoding(cp866); getRequestCycleSettings().setResponseRequestEncoding(cp866); (2) template use cp866 ecoding both in ?xml and meta tag. On 9/26/06, Johan Compagner [EMAIL PROTECTED] wrote:If you set the request encoding to Big5.What does the browser say when you ask for where it is in? johanOn 9/26/06, Ingram Chen [EMAIL PROTECTED] wrote: Thanks the advice!Some chars just can't translated into Big5. Big5 is popular Chinese encoding before unicode in Taiwan... etc and it lack some rare chars defined in unicode. make conversion at DAO layer would be good or even migrate db to unicode is better but it require a lot effort. My problem is just Wicket Ajax not work correctly in different encoding. If it couldn't be solved, we are forced to give up wicket ajax and fallback to plain request...sigh Is there anything I could check or trace... ?-- Ingram ChenJava [EMAIL PROTECTED]Institue of BioMedical Sciences Academia Sinica Taiwan blog: http://www.javaworld.com.tw/roller/page/ingramchen encodingProblem.IAmZip Description: Binary data - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
Ouch! I also has similar problem... except that my encoding is Big5 (tranditional chinese)I try to build latest 1.x branch but maven complain:===Reason: Unable to download the artifact from any repository wicket:wicket-parent:pom:1.2-SNAPSHOTfrom the specified remote repositories: central (http://repo1.maven.org/maven2)=== How do I build latest branch ? or is there any nightly-snapshop ?On 9/22/06, Johan Compagner [EMAIL PROTECTED] wrote:for this we need to have a sample case.Also i checked in a encoding problem in the 1.2.x branch (and 2.0 but i don't think that one is completely fixed yet...)So if you could build/test it from svn maybe it is fixed then. johanOn 9/22/06, 王磊 [EMAIL PROTECTED] wrote: Also it brings some trouble,but i can solve the problem of encoding.But i can't know why there is not a event in the server while i input or paste a chinese word in the AutoCompleteTextField.I am not familiarwith _javascript_. Thanks for your advice .- Original Message -From: Martijn Dashorst [EMAIL PROTECTED]To: wicket-user@lists.sourceforge.netSent: Friday, September 22, 2006 3:52 PMSubject: Re: [Wicket-user] The problem about encoding and event in ajax We have had some problems with Ajax and UTF-8 encoding. You'll have to configure the uri encoding on your httpconnector to use UTF-8. In tomcat that would go into your server.xml Martijn On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: In fact, i use utf-8 as my coding. The following is the content of the html. ?xml version=1.0 encoding=UTF-8? html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head body form wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body /html I also tried many ways 1.keep meta charset or remove it. 2.keep ?xml version=1.0 encoding=UTF-8? or remove it. I can't get the right result. Another problem You can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. - Original Message - From: Erik van Oosten [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:03 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax Dear ??, The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application.String newInput = new String( input.getBytes(iso8859-1), UTF-8); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a ?. Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding(UTF-8) Then replace the line above with: String newInput = input; Regards, Erik.王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write println in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like ???d, it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes(iso8859-1), UTF-8);I think these problems are caused by _javascript_,because i am not familiar with _javascript_. So i can't give reasons. May somebody can give a patch. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Download Wicket 1.2.2 now! New Ajax components: Tree, TreeTable and ModalWindow -- http://wicketframework.org - Take Surveys. Earn
Re: [Wicket-user] The problem about encoding and event in ajax
http://www.wicket-wiki.org.uk/wiki/index.php/Wicketfromsource On 9/25/06, Ingram Chen [EMAIL PROTECTED] wrote: Ouch! I also has similar problem... except that my encoding is Big5 (tranditional chinese) I try to build latest 1.x branch but maven complain: === Reason: Unable to download the artifact from any repository wicket:wicket-parent:pom:1.2-SNAPSHOT from the specified remote repositories: central (http://repo1.maven.org/maven2) === How do I build latest branch ? or is there any nightly-snapshop ? On 9/22/06, Johan Compagner [EMAIL PROTECTED] wrote: for this we need to have a sample case. Also i checked in a encoding problem in the 1.2.x branch (and 2.0 but i don't think that one is completely fixed yet...) So if you could build/test it from svn maybe it is fixed then. johan On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: Also it brings some trouble,but i can solve the problem of encoding. But i can't know why there is not a event in the server while i input or paste a chinese word in the AutoCompleteTextField. I am not familiar with javascript. Thanks for your advice . - Original Message - From: Martijn Dashorst [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:52 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax We have had some problems with Ajax and UTF-8 encoding. You'll have to configure the uri encoding on your httpconnector to use UTF-8. In tomcat that would go into your server.xml Martijn On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: In fact, i use utf-8 as my coding. The following is the content of the html. ?xml version=1.0 encoding=UTF-8? html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head body form wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body /html I also tried many ways 1.keep meta charset or remove it. 2.keep ?xml version=1.0 encoding=UTF-8? or remove it. I can't get the right result. Another problem You can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. - Original Message - From: Erik van Oosten [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:03 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax Dear ??, The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application. String newInput = new String( input.getBytes(iso8859-1), UTF-8); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a ?. Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding(UTF-8) Then replace the line above with: String newInput = input; Regards, Erik. 王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write println in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like ???d, it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes(iso8859-1), UTF-8); I think these problems are caused by javascript,because i am not familiar with javascript. So i can't give reasons. May somebody can give a patch. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash.
Re: [Wicket-user] The problem about encoding and event in ajax
Thanks information, I just manually compile and test latest snapshop. But unfortunately the encoding still not work right...I will create a quickstart to reproduce it!On 9/25/06, Martijn Dashorst [EMAIL PROTECTED] wrote: http://www.wicket-wiki.org.uk/wiki/index.php/WicketfromsourceOn 9/25/06, Ingram Chen [EMAIL PROTECTED] wrote: Ouch! I also has similar problem... except that my encoding is Big5 (tranditional chinese) I try to build latest 1.x branch but maven complain: === Reason: Unable to download the artifact from any repository wicket:wicket-parent:pom:1.2-SNAPSHOT from the specified remote repositories: central ( http://repo1.maven.org/maven2) === How do I build latest branch ?or is there any nightly-snapshop? On 9/22/06, Johan Compagner [EMAIL PROTECTED] wrote: for this we need to have a sample case. Also i checked in a encoding problem in the 1.2.x branch (and 2.0 but i don't think that one is completely fixed yet...) So if you could build/test it from svn maybe it is fixed then. johan On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: Also it brings some trouble,but i can solve the problem of encoding. But i can't know why there is not a event in the server while i input or paste a chinese word in the AutoCompleteTextField. I am not familiarwith _javascript_. Thanks for your advice . - Original Message - From: Martijn Dashorst [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:52 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax We have had some problems with Ajax and UTF-8 encoding. You'll have toconfigure the uri encoding on your httpconnector to use UTF-8. In tomcat that would go into your server.xml Martijn On 9/22/06, 王磊 [EMAIL PROTECTED] wrote:In fact, i use utf-8 as my coding.The following is the content of the html. ?xml version= 1.0 encoding=UTF-8?htmlheadmeta http-equiv=Content-Type content=text/html; charset=UTF-8 /headbodyform wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body/html I also tried many ways1.keep meta charset or remove it. 2.keep ?xml version=1.0 encoding=UTF-8? or remove it. I can't get the right result. Another problemYou can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. - Original Message -From: Erik van Oosten [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.netSent: Friday, September 22, 2006 3:03 PMSubject: Re: [Wicket-user] The problem about encoding and event in ajax Dear ??, The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application. String newInput = new String( input.getBytes(iso8859-1), UTF-8); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a ?. Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding(UTF-8) Then replace the line above with: String newInput = input; Regards, Erik. 王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write println in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like ???d, it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes(iso8859-1), UTF-8); I think these problems are caused by _javascript_,because i am not familiar with _javascript_. So i can't give reasons. May somebody can give a patch. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
Ok, wicket-example can reproduce this bug:go to:http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:wicket.examples.ajax.builtin.EditableLabelPage and input to a EditableLabel by several chars: French êèéæøåand output become: French êèÃæøå On 9/25/06, Ingram Chen [EMAIL PROTECTED] wrote: Thanks information, I just manually compile and test latest snapshop. But unfortunately the encoding still not work right...I will create a quickstart to reproduce it! On 9/25/06, Martijn Dashorst [EMAIL PROTECTED] wrote: http://www.wicket-wiki.org.uk/wiki/index.php/WicketfromsourceOn 9/25/06, Ingram Chen [EMAIL PROTECTED] wrote: Ouch! I also has similar problem... except that my encoding is Big5 (tranditional chinese) I try to build latest 1.x branch but maven complain: === Reason: Unable to download the artifact from any repository wicket:wicket-parent:pom:1.2-SNAPSHOT from the specified remote repositories: central ( http://repo1.maven.org/maven2) === How do I build latest branch ?or is there any nightly-snapshop? On 9/22/06, Johan Compagner [EMAIL PROTECTED] wrote: for this we need to have a sample case. Also i checked in a encoding problem in the 1.2.x branch (and 2.0 but i don't think that one is completely fixed yet...) So if you could build/test it from svn maybe it is fixed then. johan On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: Also it brings some trouble,but i can solve the problem of encoding. But i can't know why there is not a event in the server while i input or paste a chinese word in the AutoCompleteTextField. I am not familiarwith _javascript_. Thanks for your advice . - Original Message - From: Martijn Dashorst [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:52 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax We have had some problems with Ajax and UTF-8 encoding. You'll have toconfigure the uri encoding on your httpconnector to use UTF-8. In tomcat that would go into your server.xml Martijn On 9/22/06, 王磊 [EMAIL PROTECTED] wrote:In fact, i use utf-8 as my coding.The following is the content of the html. ?xml version= 1.0 encoding=UTF-8?htmlheadmeta http-equiv=Content-Type content=text/html; charset=UTF-8 /headbodyform wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body/html I also tried many ways1.keep meta charset or remove it. 2.keep ?xml version=1.0 encoding=UTF-8? or remove it. I can't get the right result. Another problemYou can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. - Original Message -From: Erik van Oosten [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.netSent: Friday, September 22, 2006 3:03 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax Dear ??, The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application. String newInput = new String( input.getBytes(iso8859-1), UTF-8); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a ?. Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding(UTF-8) Then replace the line above with: String newInput = input; Regards, Erik. 王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write println in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like ???d, it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes(iso8859-1), UTF-8); I think these problems are caused by _javascript_,because i am not familiar with _javascript_. So i can't give reasons. May somebody can give a patch. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics
Re: [Wicket-user] The problem about encoding and event in ajax
This is not a thing wicket can do something about.This is the URI encoding that must be set in the tomcat connector itself: URIEncoding=UTF-8Because it is a http get request the params are encoded differently (a different property) by tomcat Why that is i don't know. But you just have to set that.johanOn 9/25/06, Ingram Chen [EMAIL PROTECTED] wrote:Ok, wicket-example can reproduce this bug:go to: http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:wicket.examples.ajax.builtin.EditableLabelPage and input to a EditableLabel by several chars: French êèéæøåand output become: French êèÃæøå On 9/25/06, Ingram Chen [EMAIL PROTECTED] wrote: Thanks information, I just manually compile and test latest snapshop. But unfortunately the encoding still not work right...I will create a quickstart to reproduce it! On 9/25/06, Martijn Dashorst [EMAIL PROTECTED] wrote: http://www.wicket-wiki.org.uk/wiki/index.php/WicketfromsourceOn 9/25/06, Ingram Chen [EMAIL PROTECTED] wrote: Ouch! I also has similar problem... except that my encoding is Big5 (tranditional chinese) I try to build latest 1.x branch but maven complain: === Reason: Unable to download the artifact from any repository wicket:wicket-parent:pom:1.2-SNAPSHOT from the specified remote repositories: central ( http://repo1.maven.org/maven2) === How do I build latest branch ?or is there any nightly-snapshop? On 9/22/06, Johan Compagner [EMAIL PROTECTED] wrote: for this we need to have a sample case. Also i checked in a encoding problem in the 1.2.x branch (and 2.0 but i don't think that one is completely fixed yet...) So if you could build/test it from svn maybe it is fixed then. johan On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: Also it brings some trouble,but i can solve the problem of encoding. But i can't know why there is not a event in the server while i input or paste a chinese word in the AutoCompleteTextField. I am not familiarwith _javascript_. Thanks for your advice . - Original Message - From: Martijn Dashorst [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:52 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax We have had some problems with Ajax and UTF-8 encoding. You'll have toconfigure the uri encoding on your httpconnector to use UTF-8. In tomcat that would go into your server.xml Martijn On 9/22/06, 王磊 [EMAIL PROTECTED] wrote:In fact, i use utf-8 as my coding.The following is the content of the html. ?xml version= 1.0 encoding=UTF-8?htmlheadmeta http-equiv=Content-Type content=text/html; charset=UTF-8 /headbodyform wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body/html I also tried many ways1.keep meta charset or remove it. 2.keep ?xml version=1.0 encoding=UTF-8? or remove it. I can't get the right result. Another problemYou can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. - Original Message -From: Erik van Oosten [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.netSent: Friday, September 22, 2006 3:03 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax Dear ??, The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application. String newInput = new String( input.getBytes(iso8859-1), UTF-8); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a ?. Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding(UTF-8) Then replace the line above with: String newInput = input; Regards, Erik. 王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write println in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like ???d, it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes(iso8859-1), UTF-8); I think these problems are caused by _javascript_,because i am not familiar with _javascript_. So i can't give reasons. May
Re: [Wicket-user] The problem about encoding and event in ajax
Well, if this causes trouble, perhaps we could post the information. It is a bit more work but it would be worth it. -Matej Johan Compagner wrote: This is not a thing wicket can do something about. This is the URI encoding that must be set in the tomcat connector itself: URIEncoding=UTF-8 Because it is a http get request the params are encoded differently (a different property) by tomcat Why that is i don't know. But you just have to set that. johan On 9/25/06, *Ingram Chen* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Ok, wicket-example can reproduce this bug: go to: http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:wicket.examples.ajax.builtin.EditableLabelPage http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:wicket.examples.ajax.builtin.EditableLabelPage and input to a EditableLabel by several chars: French êèéæøå and output become: French êèéæøå On 9/25/06, *Ingram Chen* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thanks information, I just manually compile and test latest snapshop. But unfortunately the encoding still not work right... I will create a quickstart to reproduce it! On 9/25/06, *Martijn Dashorst* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: http://www.wicket-wiki.org.uk/wiki/index.php/Wicketfromsource On 9/25/06, Ingram Chen [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Ouch! I also has similar problem... except that my encoding is Big5 (tranditional chinese) I try to build latest 1.x branch but maven complain: === Reason: Unable to download the artifact from any repository wicket:wicket-parent:pom:1.2-SNAPSHOT from the specified remote repositories: central ( http://repo1.maven.org/maven2) === How do I build latest branch ? or is there any nightly-snapshop ? On 9/22/06, Johan Compagner [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: for this we need to have a sample case. Also i checked in a encoding problem in the 1.2.x branch (and 2.0 but i don't think that one is completely fixed yet...) So if you could build/test it from svn maybe it is fixed then. johan On 9/22/06, 王磊 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Also it brings some trouble,but i can solve the problem of encoding. But i can't know why there is not a event in the server while i input or paste a chinese word in the AutoCompleteTextField. I am not familiar with javascript. Thanks for your advice . - Original Message - From: Martijn Dashorst [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net mailto:wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:52 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax We have had some problems with Ajax and UTF-8 encoding. You'll have to configure the uri encoding on your httpconnector to use UTF-8. In tomcat that would go into your server.xml Martijn On 9/22/06, 王磊 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: In fact, i use utf-8 as my coding. The following is the content of the html. ?xml version= 1.0 encoding=UTF-8? html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head body form wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body /html I also tried many ways 1.keep meta charset or remove it. 2.keep
Re: [Wicket-user] The problem about encoding and event in ajax
That's strange. I've tried wicket examples and the only one that didn't work was the editable label one, which used get to send the data to server. All other examples worked for me. I don't understand why you can't use utf-8 encoding. What has this to do with your database encoding? In java all strings are internally unicode. How does encoding of your html pages and urls affects your database? -Matej Ingram Chen wrote: My case is even I use post (AjaxSubmitButton), I still get garbage text after submit My configuration is: (1) Application: getMarkupSettings().setDefaultMarkupEncoding( Big5); getRequestCycleSettings().setResponseRequestEncoding(Big5); (2) Template: ?xml version=1.0 encoding=Big5 ? !DOCTYPE ... html head meta http-equiv=Content-Type content=text/html; style=color: rgb(255, 0, 0);Big5 / (3) part of Page: Form form = new Form(form); add(form.setOutputMarkupId(true)); form.add(new TextField(text, new PropertyModel(this, text))); form.add(new AjaxSubmitButton(ajaxsubmit, form) { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { target.addComponent(form); } }); (4) runing on jetty (or on tomcat with either URIEncoding=UTF-8 or Big5) I try all of combinations and only work setting is turn off all encoding settings, let them fall back to default UTF-8. Yes, UTF-8 do work but the system is old and equip with a legacy database which is Big5 based I could build a quickstart to demo it but it will be Chinese. Could someone please provide a different encoding and some charactors to me to build the demo ? On 9/25/06, *Matej Knopp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Well, if this causes trouble, perhaps we could post the information. It is a bit more work but it would be worth it. -Matej Johan Compagner wrote: This is not a thing wicket can do something about. This is the URI encoding that must be set in the tomcat connector itself: URIEncoding=UTF-8 Because it is a http get request the params are encoded differently (a different property) by tomcat Why that is i don't know. But you just have to set that. johan On 9/25/06, *Ingram Chen* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Ok, wicket-example can reproduce this bug: go to: http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:wicket.examples.ajax.builtin.EditableLabelPage http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:wicket.examples.ajax.builtin.EditableLabelPage and input to a EditableLabel by several chars: French êèéæøå and output become: French êèéæøå On 9/25/06, *Ingram Chen* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thanks information, I just manually compile and test latest snapshop. But unfortunately the encoding still not work right... I will create a quickstart to reproduce it! On 9/25/06, *Martijn Dashorst* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: http://www.wicket-wiki.org.uk/wiki/index.php/Wicketfromsource http://www.wicket-wiki.org.uk/wiki/index.php/Wicketfromsource On 9/25/06, Ingram Chen [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Ouch! I also has similar problem... except that my encoding is Big5 (tranditional chinese) I try to build latest 1.x branch but maven complain: === Reason: Unable to download the artifact from any repository wicket:wicket-parent:pom: 1.2-SNAPSHOT from the specified remote repositories: central ( http://repo1.maven.org/maven2) === How do I build latest branch ? or is there any nightly-snapshop ? On 9/22/06, Johan Compagner [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Re: [Wicket-user] The problem about encoding and event in ajax
Well, the database is only allowed to store chars encoded as Big5. If user input charactors, which defined in Unicode but outside of Big5 cover, the database only store garbage code like ???. By setting page encoding to Big5, the browser will escape non-Big5 chars to #; automatically. Althought database still store these escape chars, these chars can be re-rendered correctly on the web page. On 9/25/06, Matej Knopp [EMAIL PROTECTED] wrote: That's strange. I've tried wicket examples and the only one that didn'twork was the editable label one, which used get to send the data toserver. All other examples worked for me.I don't understand why you can't use utf-8 encoding. What has this to do with your database encoding? In java all strings are internally unicode.How does encoding of your html pages and urls affects your database?-Matej-- Ingram Chen Java [EMAIL PROTECTED]Institue of BioMedical Sciences Academia Sinica Taiwanblog: http://www.javaworld.com.tw/roller/page/ingramchen - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in, ajax
Thanks! It helped to deal with my problem (I had the same)!:) Message: 1 Date: Mon, 25 Sep 2006 16:45:11 +0200 From: Matej Knopp [EMAIL PROTECTED] Subject: Re: [Wicket-user] The problem about encoding and event in ajax To: wicket-user@lists.sourceforge.net Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=UTF-8; format=flowed That's strange. I've tried wicket examples and the only one that didn't work was the editable label one, which used get to send the data to server. All other examples worked for me. I don't understand why you can't use utf-8 encoding. What has this to do with your database encoding? In java all strings are internally unicode. How does encoding of your html pages and urls affects your database? -Matej - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
Can't the driver do that conversion for you?What happens if you just create a String in java with some special charsand write that to the database?The driver should be able to convert it. Or are you saying that you need to really escape it like # ?? The char just can't be translated into Big5?johanOn 9/25/06, Ingram Chen [EMAIL PROTECTED] wrote:Well, the database is only allowed to store chars encoded as Big5. If user input charactors, which defined in Unicode but outside of Big5 cover, the database only store garbage code like ???. By setting page encoding to Big5, the browser will escape non-Big5 chars to #; automatically. Althought database still store these escape chars, these chars can be re-rendered correctly on the web page. On 9/25/06, Matej Knopp [EMAIL PROTECTED] wrote: That's strange. I've tried wicket examples and the only one that didn'twork was the editable label one, which used get to send the data toserver. All other examples worked for me.I don't understand why you can't use utf-8 encoding. What has this to do with your database encoding? In java all strings are internally unicode.How does encoding of your html pages and urls affects your database?-Matej-- Ingram Chen Java [EMAIL PROTECTED]Institue of BioMedical Sciences Academia Sinica Taiwanblog: http://www.javaworld.com.tw/roller/page/ingramchen -Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
Yeah, I also thing that web-layer is not the best place for doing such conversion. I know it would require additional effort but I think doing the conversion at DAO layer would be much safer. -Matej Johan Compagner wrote: Can't the driver do that conversion for you? What happens if you just create a String in java with some special chars and write that to the database? The driver should be able to convert it. Or are you saying that you need to really escape it like # ?? The char just can't be translated into Big5? johan On 9/25/06, *Ingram Chen* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Well, the database is only allowed to store chars encoded as Big5. If user input charactors, which defined in Unicode but outside of Big5 cover, the database only store garbage code like ???. By setting page encoding to Big5, the browser will escape non-Big5 chars to #; automatically. Althought database still store these escape chars, these chars can be re-rendered correctly on the web page. On 9/25/06, *Matej Knopp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: That's strange. I've tried wicket examples and the only one that didn't work was the editable label one, which used get to send the data to server. All other examples worked for me. I don't understand why you can't use utf-8 encoding. What has this to do with your database encoding? In java all strings are internally unicode. How does encoding of your html pages and urls affects your database? -Matej -- Ingram Chen Java [EMAIL PROTECTED] Institue of BioMedical Sciences Academia Sinica Taiwan blog: http://www.javaworld.com.tw/roller/page/ingramchen - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net mailto:Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
Thanks the advice!Some chars just can't translated into Big5. Big5 is popular Chinese encoding before unicode in Taiwan... etc and it lack some rare chars defined in unicode.make conversion at DAO layer would be good or even migrate db to unicode is better but it require a lot effort. My problem is just Wicket Ajax not work correctly in different encoding. If it couldn't be solved, we are forced to give up wicket ajax and fallback to plain request...sigh Is there anything I could check or trace... ?On 9/26/06, Matej Knopp [EMAIL PROTECTED] wrote: Yeah, I also thing that web-layer is not the best place for doing suchconversion. I know it would require additional effort but I think doingthe conversion at DAO layer would be much safer.-MatejJohan Compagner wrote: Can't the driver do that conversion for you? What happens if you just create a String in java with some special chars and write that to the database? The driver should be able to convert it. Or are you saying that you need to really escape it like # ?? The char just can't be translated into Big5? johan On 9/25/06, *Ingram Chen* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Well, the database is only allowed to store chars encoded as Big5. If user input charactors, which defined in Unicode but outside of Big5 cover, the database only store garbage code like ???.By setting page encoding to Big5, the browser will escape non-Big5 chars to #; automatically. Althought database still store these escape chars, these chars can be re-rendered correctly on the web page. On 9/25/06, *Matej Knopp* [EMAIL PROTECTED] mailto: [EMAIL PROTECTED] wrote: That's strange. I've tried wicket examples and the only one that didn't work was the editable label one, which used get to send the data to server. All other examples worked for me. I don't understand why you can't use utf-8 encoding. What has this to do with your database encoding? In java all strings are internally unicode. How does encoding of your html pages and urls affects your database? -Matej -- Ingram Chen Java [EMAIL PROTECTED] Institue of BioMedical Sciences Academia Sinica Taiwan blog: http://www.javaworld.com.tw/roller/page/ingramchen - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net mailto:Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net 's Techsay panel and you'll get the chance to share youropinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-- Ingram ChenJava [EMAIL PROTECTED] Institue of BioMedical Sciences Academia Sinica Taiwanblog: http://www.javaworld.com.tw/roller/page/ingramchen - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
Dear ??, The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application. String newInput = new String(input.getBytes(iso8859-1), UTF-8); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a ?. Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding(UTF-8) Then replace the line above with: String newInput = input; Regards, Erik. 王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write println in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like ???d, it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes(iso8859-1), UTF-8); I think these problems are caused by javascript,because i am not familiar with javascript. So i can't give reasons. May somebody can give a patch. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
In fact, i use utf-8 as my coding. The following is the content of the html. ?xml version=1.0 encoding=UTF-8? html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head body form wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body /html I also tried many ways 1.keep meta charset or remove it. 2.keep ?xml version=1.0 encoding=UTF-8? or remove it. I can't get the right result. Another problem You can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. - Original Message - From: Erik van Oosten [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:03 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax Dear ??, The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application. String newInput = new String(input.getBytes(iso8859-1), UTF-8); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a ?. Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding(UTF-8) Then replace the line above with: String newInput = input; Regards, Erik. 王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write println in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like ???d, it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes(iso8859-1), UTF-8); I think these problems are caused by javascript,because i am not familiar with javascript. So i can't give reasons. May somebody can give a patch. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
Hello, I missed the point that you are using the AutoCompleteTextField. Sorry, can't help you there. Erik. 王磊 schreef: In fact, i use utf-8 as my coding. The following is the content of the html. ?xml version=1.0 encoding=UTF-8? html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head body form wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body /html I also tried many ways 1.keep meta charset or remove it. 2.keep ?xml version=1.0 encoding=UTF-8? or remove it. I can't get the right result. Another problem You can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
We have had some problems with Ajax and UTF-8 encoding. You'll have to configure the uri encoding on your httpconnector to use UTF-8. In tomcat that would go into your server.xml Martijn On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: In fact, i use utf-8 as my coding. The following is the content of the html. ?xml version=1.0 encoding=UTF-8? html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head body form wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body /html I also tried many ways 1.keep meta charset or remove it. 2.keep ?xml version=1.0 encoding=UTF-8? or remove it. I can't get the right result. Another problem You can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. - Original Message - From: Erik van Oosten [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:03 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax Dear ??, The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application. String newInput = new String(input.getBytes(iso8859-1), UTF-8); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a ?. Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding(UTF-8) Then replace the line above with: String newInput = input; Regards, Erik. 王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write println in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like ???d, it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes(iso8859-1), UTF-8); I think these problems are caused by javascript,because i am not familiar with javascript. So i can't give reasons. May somebody can give a patch. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Download Wicket 1.2.2 now! New Ajax components: Tree, TreeTable and ModalWindow -- http://wicketframework.org - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] The problem about encoding and event in ajax
Also it brings some trouble,but i can solve the problem of encoding. But i can't know why there is not a event in the server while i input or paste a chinese word in the AutoCompleteTextField. I am not familiar with javascript. Thanks for your advice . - Original Message - From: Martijn Dashorst [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:52 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax We have had some problems with Ajax and UTF-8 encoding. You'll have to configure the uri encoding on your httpconnector to use UTF-8. In tomcat that would go into your server.xml Martijn On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: In fact, i use utf-8 as my coding. The following is the content of the html. ?xml version=1.0 encoding=UTF-8? html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head body form wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body /html I also tried many ways 1.keep meta charset or remove it. 2.keep ?xml version=1.0 encoding=UTF-8? or remove it. I can't get the right result. Another problem You can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. - Original Message - From: Erik van Oosten [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:03 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax Dear ??, The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application. String newInput = new String(input.getBytes(iso8859-1), UTF-8); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a ?. Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding(UTF-8) Then replace the line above with: String newInput = input; Regards, Erik. 王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write println in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like ???d, it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes(iso8859-1), UTF-8); I think these problems are caused by javascript,because i am not familiar with javascript. So i can't give reasons. May somebody can give a patch. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Download Wicket 1.2.2 now! New Ajax components: Tree, TreeTable and ModalWindow -- http://wicketframework.org - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and
Re: [Wicket-user] The problem about encoding and event in ajax
for this we need to have a sample case.Also i checked in a encoding problem in the 1.2.x branch (and 2.0 but i don't think that one is completely fixed yet...)So if you could build/test it from svn maybe it is fixed then. johanOn 9/22/06, 王磊 [EMAIL PROTECTED] wrote: Also it brings some trouble,but i can solve the problem of encoding.But i can't know why there is not a event in the server while i input or paste a chinese word in the AutoCompleteTextField.I am not familiarwith _javascript_. Thanks for your advice .- Original Message -From: Martijn Dashorst [EMAIL PROTECTED]To: wicket-user@lists.sourceforge.netSent: Friday, September 22, 2006 3:52 PMSubject: Re: [Wicket-user] The problem about encoding and event in ajax We have had some problems with Ajax and UTF-8 encoding. You'll have to configure the uri encoding on your httpconnector to use UTF-8. In tomcat that would go into your server.xml Martijn On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: In fact, i use utf-8 as my coding. The following is the content of the html. ?xml version=1.0 encoding=UTF-8? html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head body form wicket:id=formCountry: input type=text wicket:id=ac size=50 //form /body /html I also tried many ways 1.keep meta charset or remove it. 2.keep ?xml version=1.0 encoding=UTF-8? or remove it. I can't get the right result. Another problem You can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. - Original Message - From: Erik van Oosten [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:03 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax Dear ??, The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application.String newInput = new String( input.getBytes(iso8859-1), UTF-8); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a ?. Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding(UTF-8) Then replace the line above with: String newInput = input; Regards, Erik.王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write println in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like ???d, it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes(iso8859-1), UTF-8);I think these problems are caused by _javascript_,because i am not familiar with _javascript_. So i can't give reasons. May somebody can give a patch. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Download Wicket 1.2.2 now! New Ajax components: Tree, TreeTable and ModalWindow -- http://wicketframework.org - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -Take Surveys. Earn Cash. Influence the Future of ITJoin
Re: [Wicket-user] The problem about encoding and event in ajax
I think this problem is caused by javaSciprt. Additionally, i can use textfield with ajx. There is no problems. The following is the code. The code are simple,most of them are the same as the example of ajax. Just with a println statement to show whether there is a event while input a chinese word. Thanks for all of you to give me advice. Html Template: ?xml version="1.0" encoding="UTF-8"?htmlheadmeta http-equiv="Content-Type" content="text/html; charset=UTF-8"/headbody br / form wicket:id="form"Country: input type="text" wicket:id="ac" size="50" //form /body/html Java Code: public class AutoPage extends WebPage { public AutoPage() {super();Form form = new Form("form");add(form);AutoCompleteTextField textField;textField = new AutoCompleteTextField("ac", new Model("")) {protected Iterator getChoices(String input) { String newInput;try { newInput = new String(input.getBytes("iso8859-1"), "UTF-8"); } catch (UnsupportedEncodingException e) {e.printStackTrace();newInput = input;} if (Strings.isEmpty(input)) {return Collections.EMPTY_LIST.iterator();} List choices = new ArrayList(10); Locale[] locales = Locale.getAvailableLocales(); for (int i = 0; i locales.length; i++) {final Locale locale = locales[i];final String country = locale.getDisplayCountry(); if (country.toUpperCase().startsWith(input.toUpperCase())) {choices.add(country);if (choices.size() == 10) {break;}}} return choices.iterator();}}; form.add(textField);}} - Original Message - From: Johan Compagner To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 4:56 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax for this we need to have a sample case.Also i checked in a encoding problem in the 1.2.x branch (and 2.0 but i don't think that one is completely fixed yet...)So if you could build/test it from svn maybe it is fixed then. johan On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: Also it brings some trouble,but i can solve the problem of encoding.But i can't know why there is not a event in the server while i input or paste a chinese word in the AutoCompleteTextField.I am not familiarwith _javascript_. Thanks for your advice .- Original Message -From: "Martijn Dashorst" [EMAIL PROTECTED]To: wicket-user@lists.sourceforge.netSent: Friday, September 22, 2006 3:52 PMSubject: Re: [Wicket-user] The problem about encoding and event in ajax We have had some problems with Ajax and UTF-8 encoding. You'll have to configure the uri encoding on your httpconnector to use UTF-8. In tomcat that would go into your server.xml Martijn On 9/22/06, 王磊 [EMAIL PROTECTED] wrote: In fact, i use utf-8 as my coding. The following is the content of the html. ?xml version="1.0" encoding="UTF-8"? html head meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /head body form wicket:id="form"Country: input type="text" wicket:id="ac" size="50" //form /body /html I also tried many ways 1.keep meta charset or remove it. 2.keep ?xml version="1.0" encoding="UTF-8"? or remove it. I can't get the right result. Another problem You can copy a chinese word and paste to the AutoCompleteTextField, no event will fired.You can see it in the server side. - Original Message - From: "Erik van Oosten" [EMAIL PROTECTED] To: wicket-user@lists.sourceforge.net Sent: Friday, September 22, 2006 3:03 PM Subject: Re: [Wicket-user] The problem about encoding and event in ajax Dear ??,The problem is because you can not encode Chinese characters in ISO-8859-1. You must use UTF-8 throughout your application. String newInput = new String( input.getBytes("iso8859-1"), "UTF-8"); first converts the string to ISO8859-1 and thereby replaces all Chinese characters with a "?". Please make sure that the HTML pages that Wicket renders are in UTF-8. This true by default, but to be sure you could do getRequestCycleSettings().setResponseRequestEncoding("UTF-8") Then replace the line above with: String newInput = input; Regards, Erik. 王磊 schreef: I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2 problems. 1. If i input a chinese word,no request is sent to the server side.(I write "println" in server application,no output).2. If in input a chinese word,then input a
[Wicket-user] The problem about encoding and event in ajax
I just try to write a book about wicket.(It's written in chinese,and it's free to get a e-book). But while i writing a ajax example,i got a stange problem. I writed a auto-complete text application with AutoCompleteTextField control. But i got the following 2problems. 1. If i input a chinese word,no request is sent to the server side.(I write "println" in server application,no output). 2. If in input a chinese word,then input a letter like 'd',the server side will get a string input like "???d",it's in wrong code. I use the following code to get the right input. String newInput = new String(input.getBytes("iso8859-1"), "UTF-8"); I think these problems are caused by _javascript_,because i am not familiar with _javascript_. So i can't give reasons. May somebody can give a patch. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user