Oops. Small mistake. The ";" is the parameter separator. We need to add a step to split along "/" for the hierarchy, and then we need to unescape "\3" to "/".
We ran into exact same problem over this weekend.
Daniel if you are not going to get to it would you like me to take a
look at it?
I am working on it today and tomorrow.
Mayumi
On Nov 25, 5:10 am, Daniel Colchete <d...@cloud3.tc> wrote:
> Hi Phillipe!
>
> Great! I think your idea solves everything. I'll work on it next week.
>
> Best,
> Dani
>
> On Thu, Nov 24, 2011 at 11:54 AM, Philippe Beaudoin <
>
>
>
>
>
>
>
>
>
> philippe.beaud...@gmail.com> wrote:
> > I've thought a bit more about it, here is my idea...
>
> > Right now the decoding process is:
> > - Split the hierarchy along ;
> > - Split the assignations along =
> > - Unescape all the components obtained
>
> > I suggest the following:
> > - Unescape everything
> > - Split the hierarchy along ;
> > - Split the assignations along =
> > - Within the components, unescape "\0" to ";", "\1" to "=" and "\2" to "\"
>
> > (In both case, encoding is simply inverting the steps and playing them in
> > reverse.)
>
> > I believe this works because the first thing we do is unescape. So no
> > matter what the sender decided to escape, we'll get it. We will work on
> > legacy URLs like:
> > http://mysite.com/project.html#nametoken;param1=value1;param2=value2
> > And with fully escaped URLs:
>
> >http://mysite.com/project.html#nametoken%3bparam1%3dvalue1%3bparam2%3...
>
> > For situations like where we want to encode:
> > { ('data_A', 'junk;=\'), ('data_B, 'more_junk;=\') }
> > then we will work with the following URL:
>
> >http://mysite.com/project.html#nametoken;data_A=junk\0\1\2;data_B=more_junk\0\1\2
> > This encoded URL:
>
> >http://mysite.com/project.html#nametoken;data_A=junk%5C0%5C1%5C2;data...
> > And even this one:
>
> >http://mysite.com/project.html#nametoken%3bdata_A%3djunk%5C0%5C1%5C2%...
Hi Daniel and Philippe,
We ran into exact same problem over this weekend.
Daniel if you are not going to get to it would you like me to take a
look at it?
I am working on it today and tomorrow.
Mayumi
On Nov 25, 5:10 am, Daniel Colchete <d...@cloud3.tc> wrote:
> Hi Phillipe!
>
> Great! I think your idea solves everything. I'll work on it next week.
>
> Best,
> Dani
>
> On Thu, Nov 24, 2011 at 11:54 AM, Philippe Beaudoin <
>
> philippe.beaud...@gmail.com> wrote:
> > I've thought a bit more about it, here is my idea...
>
> > Right now the decoding process is:
> > - Split the hierarchy along ;
> > - Split the assignations along =
> > - Unescape all the components obtained
>
> > I suggest the following:
> > - Unescape everything
> > - Split the hierarchy along ;
> > - Split the assignations along =
> > - Within the components, unescape "\0" to ";", "\1" to "=" and "\2" to "\"
>
Good day everyone!I just posted the first version of the new token formatter on the issue page [1]. I changed one part the of encoding process. Instead of URL.encode()ing everything in the end, I only encode params and values so that the new URLs are similar to the old ones. This means that the \0 is escaped to %5C0, \1 is escaped to %5C1, and so on. The decoding process URL.decode()s everything twice, before the parser jumps in, and also when decoding params and values.
In the end, old-URLs works, but for the corner cases where [=;/\] is used inside parameter names or values, emailed URL works, bookmarking works, copying and pasting URL works. I tested with PlaceManager.revealPlace, PlaceManager.buildHistoryToken (for the email part), Ctrl+C Ctrl+V and the URL bar and encoding the fragment part of the URL again manually (like a mail user agent would). It seems to be working fine. If anyone finds any problem please let-me know and I'll fix it.The code is based on ParamTokenFormatter. So I kept and updated the documentation accordingly. Two new functions are introduced to do our own \N encoding. I tried to use String.replaceAll() first but the current implementation works twice as fast. And it is really fast indeed. On my laptop, a Core 2 Duo, it can do about half a million encodoings of a 40-char sentence per second, so I didn't tried to get it any faster, although JSNI would be my next try.Of course the Class name and Package name will have to be changed. This is the version that works inside my test project.[1] http://code.google.com/p/gwt-platform/issues/detail?id=381
Please let me know what you all think.