You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thomas Heigl <th...@umschalt.com> on 2014/07/12 11:22:19 UTC
String length validation and windows line breaks
Hey all,
Recenty, probably after moving to Wicket 6.16, we see some strange behavior
for TextAreas.
We have been using a JavaScript library to limit the number of characters a
user can enter in a textbox for years. Now we started getting validation
exceptions on the server that the user entered a too many characters. It
turned out that Wicket counts Windows '\r\n' as two characters, while JS
counts them as one.
We can easily fix that with a custom StringConverter that replaces Windows
linebreaks, but I was wondering if there were some recent changes in Wicket
that could have triggered these issues?
Cheers,
Thomas
Re: String length validation and windows line breaks
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
I think there are no such changes in Wicket lately.
Just tried
"a\r\nb".length
and
"a\n\rb".length
in Google Chrome's console and both return 4
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Sat, Jul 12, 2014 at 12:22 PM, Thomas Heigl <th...@umschalt.com> wrote:
> Hey all,
>
> Recenty, probably after moving to Wicket 6.16, we see some strange behavior
> for TextAreas.
>
> We have been using a JavaScript library to limit the number of characters a
> user can enter in a textbox for years. Now we started getting validation
> exceptions on the server that the user entered a too many characters. It
> turned out that Wicket counts Windows '\r\n' as two characters, while JS
> counts them as one.
>
> We can easily fix that with a custom StringConverter that replaces Windows
> linebreaks, but I was wondering if there were some recent changes in Wicket
> that could have triggered these issues?
>
> Cheers,
>
> Thomas
>