Re: Whats the GWT equivalent of urlencode?
On 27 mar, 17:45, darkflame wrote: > I got data being recieved in my GWT program from a PHP function which > is using urlencode(string) to encode the data. > > What do I need to do on the GWT to correctly decode this data? > > I tried just " URL.decode(string) " but this clearly isnt decodeing > it correctly (slash's, for example, are still "+%2F") > > What other decodeing functinos are there? URL.decodeComponent(String) is the thing to use to decode PHP's urlencode(string) result. URL.encode()/URL.decode() is designed to work with full URLs (i.e. turn "http://example.net/foo bar/bâz?q=uüx" into "http://example.net/ foo%20bar/b%C3%A2z?q=u%C3%BCx") See: https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Functions/decodeURI (the thing behind URL.decode()) https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Functions/decodeURIComponent (the thing behind URL.decodeComponent()) And if you plan using URL.encodeComponent, see http://code.google.com/p/google-web-toolkit/issues/detail?id=3374 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Whats the GWT equivalent of urlencode?
Sorry (doh!) forward slash, not backslash. Ian http://examples.roughian.com 2009/3/27 Ian Bambury > Sorry, I didn't read your first post, just the one I replied to. > This is not a uniquely GWT problem, it is a PHP/JavaScript problem (as GWT > just calls a JS function) > > PHP encodes differently to JS. > > The only problem I am aware of (maybe other people can chip in here) is PHP > encoding the backslash. '()*~! all seem OK, but I haven't had too much > involvement with this. > > If no-one comes up with a better solution then a simple replace might be > the best answer. > > Ian > > http://examples.roughian.com > > > 2009/3/27 Thomas Wrobel > >> >> Well, something is being encoded as 2F by php, and not being decoded. >> (along with a lot of other random changes) I'm most certainly not >> getting the same strings in/out with >> >> urlencode(String) on the php side and URL.decode(string) on the java >> side. >> >> My tests where just with random generated strings, I expected just to >> confirm it was the same, but it dosnt seem to be. >> >> I just want a guarantied way to communicate between php and gwt with >> preservation of *all* characters frankly. (as I may want to send >> encrypted strings, I dont want to worry about what characters I can >> use/not use in the encyption). >> >> ~~ >> Reviews of anything, by anyone; >> www.rateoholic.co.uk >> Please try out my new site and give feedback :) >> >> >> >> 2009/3/27 Ian Bambury : >> > 2F is a forward slash which doesn't get encoded therefore doesn't need >> > decoding >> > 5C is the backslash which works OK for me >> > Ian >> > >> > http://examples.roughian.com >> > >> > >> > 2009/3/27 Thomas Wrobel >> >> >> >> That was the one I tried already, it dosnt decode backslash's >> correctly. >> >> (that is "+%2F" isnt decoded) >> >> Thanks anyway. >> >> >> >> ~~ >> >> Reviews of anything, by anyone; >> >> www.rateoholic.co.uk >> >> Please try out my new site and give feedback :) >> >> >> >> >> >> >> >> 2009/3/27 mel : >> >> > >> >> > >> >> > Its URL.encode(String) from the com.google.gwt.http.client package. >> >> > > >> >> > >> >> >> >> >> > >> > >> > > >> > >> >> >> >> > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Whats the GWT equivalent of urlencode?
Sorry, I didn't read your first post, just the one I replied to. This is not a uniquely GWT problem, it is a PHP/JavaScript problem (as GWT just calls a JS function) PHP encodes differently to JS. The only problem I am aware of (maybe other people can chip in here) is PHP encoding the backslash. '()*~! all seem OK, but I haven't had too much involvement with this. If no-one comes up with a better solution then a simple replace might be the best answer. Ian http://examples.roughian.com 2009/3/27 Thomas Wrobel > > Well, something is being encoded as 2F by php, and not being decoded. > (along with a lot of other random changes) I'm most certainly not > getting the same strings in/out with > > urlencode(String) on the php side and URL.decode(string) on the java > side. > > My tests where just with random generated strings, I expected just to > confirm it was the same, but it dosnt seem to be. > > I just want a guarantied way to communicate between php and gwt with > preservation of *all* characters frankly. (as I may want to send > encrypted strings, I dont want to worry about what characters I can > use/not use in the encyption). > > ~~ > Reviews of anything, by anyone; > www.rateoholic.co.uk > Please try out my new site and give feedback :) > > > > 2009/3/27 Ian Bambury : > > 2F is a forward slash which doesn't get encoded therefore doesn't need > > decoding > > 5C is the backslash which works OK for me > > Ian > > > > http://examples.roughian.com > > > > > > 2009/3/27 Thomas Wrobel > >> > >> That was the one I tried already, it dosnt decode backslash's correctly. > >> (that is "+%2F" isnt decoded) > >> Thanks anyway. > >> > >> ~~ > >> Reviews of anything, by anyone; > >> www.rateoholic.co.uk > >> Please try out my new site and give feedback :) > >> > >> > >> > >> 2009/3/27 mel : > >> > > >> > > >> > Its URL.encode(String) from the com.google.gwt.http.client package. > >> > > > >> > > >> > >> > > > > > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Whats the GWT equivalent of urlencode?
Well, something is being encoded as 2F by php, and not being decoded. (along with a lot of other random changes) I'm most certainly not getting the same strings in/out with urlencode(String) on the php side and URL.decode(string) on the java side. My tests where just with random generated strings, I expected just to confirm it was the same, but it dosnt seem to be. I just want a guarantied way to communicate between php and gwt with preservation of *all* characters frankly. (as I may want to send encrypted strings, I dont want to worry about what characters I can use/not use in the encyption). ~~ Reviews of anything, by anyone; www.rateoholic.co.uk Please try out my new site and give feedback :) 2009/3/27 Ian Bambury : > 2F is a forward slash which doesn't get encoded therefore doesn't need > decoding > 5C is the backslash which works OK for me > Ian > > http://examples.roughian.com > > > 2009/3/27 Thomas Wrobel >> >> That was the one I tried already, it dosnt decode backslash's correctly. >> (that is "+%2F" isnt decoded) >> Thanks anyway. >> >> ~~ >> Reviews of anything, by anyone; >> www.rateoholic.co.uk >> Please try out my new site and give feedback :) >> >> >> >> 2009/3/27 mel : >> > >> > >> > Its URL.encode(String) from the com.google.gwt.http.client package. >> > > >> > >> >> > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Whats the GWT equivalent of urlencode?
2F is a forward slash which doesn't get encoded therefore doesn't need decoding 5C is the backslash which works OK for me Ian http://examples.roughian.com 2009/3/27 Thomas Wrobel > > That was the one I tried already, it dosnt decode backslash's correctly. > (that is "+%2F" isnt decoded) > Thanks anyway. > > ~~ > Reviews of anything, by anyone; > www.rateoholic.co.uk > Please try out my new site and give feedback :) > > > > 2009/3/27 mel : > > > > > > Its URL.encode(String) from the com.google.gwt.http.client package. > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Whats the GWT equivalent of urlencode?
That was the one I tried already, it dosnt decode backslash's correctly. (that is "+%2F" isnt decoded) Thanks anyway. ~~ Reviews of anything, by anyone; www.rateoholic.co.uk Please try out my new site and give feedback :) 2009/3/27 mel : > > > Its URL.encode(String) from the com.google.gwt.http.client package. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Whats the GWT equivalent of urlencode?
Its URL.encode(String) from the com.google.gwt.http.client package. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---