>
> It does look like there is a real difference between Java's trim() and the 
> following JavaScript:
>
>
>    1. var r1 = this.replace(/^(\s*)/, '');
>    2. var r2 = r1.replace(/\s*$/, '');
>
>
> A JavaScript whitespace character can be:
>
>    - A space character
>    - A tab character
>    - A carriage return character
>    - A new line character
>    - A vertical tab character
>    - A form feed character
>
> Our Strings are all filled with null characters ('\0')) due to our ancient 
> C backend. trim() in Java works perfectly for this. But GWT's 
> production/JavaScript trim() does not work. This leads to much of our app 
> being broken due to comparison checks that worked in DevMode, not working 
> in production.
>

Maybe worth a bug entry.

 

> We are going to have to remove every instance of trim() (just under 100) 
> from our client side code base. This of course has the possibility of 
> introducing other bugs and display issues. We can replace the usages of 
> trim().isEmpty() with checks for charAt(0) == '\0' but it is not as clean.
>
> Another option is to just fix this issue in the SDK and ship our 
> production product with a modified GWT SDK, but I think that there would be 
> some management/customers unhappy with this.
>

Is there any reason why you don't trim always when the value is retrieved 
from the C backend and append a null character when the String is supposed 
to go back to your C backend, so basically correct the string on Java 
server side on the fly? Would drive me crazy if I would always need to call 
trim() in every equals just because of possible null characters (regardless 
if this equals happens on server or client side)


-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to