Thursday, April 4, 2013

Re: Upload a file - special characters are converted to html chars?

As far as I know, GWT posts/submits to an iframe and then reads the iframe's content which you access through event.getResults(). So after a form submit is complete the iframe contains your server response. If you don't send back the uploaded file from server to client, SubmitCompleteEvent.getResults() will not contain your file contents.

Its probably your server that sends back the & or you simply have a content type set on your server response which causes the browser to automatically escape your returned String because before GWT gives the result to you, it will end up in an iframe. 
For example I am used to return JSON if I need a more complex response from the server after submitting a form. Without the correct content type some browsers will return "<pre>JSON</pre>" on SubmitCompleteEvent.getResults().

I would check the server code.

Other than that you can still decode the html entities without regex by using a hidden div element + innerHTML and then read back the rendered text: http://stackoverflow.com/a/1912522

-- 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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate