You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by John Krasnay <jo...@krasnay.ca> on 2013/09/26 18:06:41 UTC

Trim nbsp from text field input

We recently experienced a bug where someone was able to enter a trailing 
space into a TextField in spite of Wicket's automatic trimming of 
whitespace. Upon further investigation it appears the user had entered a 
non-breaking space, which is not removed by the String.trim() method 
that Wicket uses. It's easy to do this accidentally, e.g. by 
cutting-and-pasting from a web page.

This is not so easy for us to correct, as FormComponent.trim(String) is 
final. We've resorted to overriding FormComponent.getInputAsArray() and 
trimming each string individually.

Should Wicket use a more robust trim method? Or should 
FormComponent.trim(String) at least be made non-final so we adjust it to 
our needs in a less clunky way?

jk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org