You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Makundi <ma...@koodaripalvelut.com> on 2017/05/03 13:06:05 UTC

Question about ajax encoding/decoding, problem with image data url

Hi!

I am trying to display (wicket 1.4) an image using base64 image data
representation.

For some reason the base64 gets garbled every time with ajax.

For example:

src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAACWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESYkSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen....

becomes (as viewed from firefox developer tools)
<img width="300" height="150" src="data:image
png;base64,ivborw0kggoaaaansuheugaaaciaaacwcayaaabncigqaaakukleqvr4no3dzyoc1xkg4pcs+g5cvxdmamzoc=""
bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesyksxlsmxhk0v1r6dpvff09h=""
jzwmhattvvae7xfnqfoen...

You can notice lots of ="" marks ="" splitting the string.


Is this a wicket encoding issue or a javascript quirk?

Thanks.

**
Martin

Re: Question about ajax encoding/decoding, problem with image data url

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
My bad. Problem solved, accidentally this part of <img> code was within a
block of markup text where all whitespace was replaced with non breaking
space.

Nbsp looks the same for naked eye but a diff tool shows the difference, and
obviously browser will render differently <img&nbsp;src="...> compared to
<img src="..>

Fun couple of hours ;)

2017-05-03 19:40 GMT+03:00 Martin Makundi <
martin.makundi@koodaripalvelut.com>:

> Really strange, works on same installation in simpler installation. No
> difference in http traffic...
>
> 2017-05-03 18:07 GMT+03:00 Martin Makundi <martin.makundi@
> koodaripalvelut.com>:
>
>> Interesting, it works in a quickstart also on v1.4.
>>
>> Need to investigate more.
>>
>> 2017-05-03 17:20 GMT+03:00 Martin Grigorov <mg...@apache.org>:
>>
>>> I don't see any reason why this could break.
>>> If you are able to reproduce it in a quickstart with 6.26/7.6 then please
>>> create a ticket in JIRA.
>>>
>>> Check what is in the Ajax response, not what is in the DOM.
>>> Also you can check with Google Chrome. Maybe Firefox does something
>>> funky.
>>>
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>>
>>> On Wed, May 3, 2017 at 4:11 PM, Martin Makundi <
>>> martin.makundi@koodaripalvelut.com> wrote:
>>>
>>> > Here is a sample how it works in jsfiddle without problems:
>>> > https://jsfiddle.net/#&togetherjs=0SQvHmm6Nj
>>> >
>>> > But when same content is in ajax update it breaks. Wonder what happens
>>> to
>>> > it before render?
>>> >
>>> > 2017-05-03 16:06 GMT+03:00 Martin Makundi <
>>> > martin.makundi@koodaripalvelut.com>:
>>> >
>>> > > Hi!
>>> > >
>>> > > I am trying to display (wicket 1.4) an image using base64 image data
>>> > > representation.
>>> > >
>>> > > For some reason the base64 gets garbled every time with ajax.
>>> > >
>>> > > For example:
>>> > >
>>> > > src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAA
>>> > > CWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/
>>> > > BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESY
>>> > > kSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen....
>>> > >
>>> > > becomes (as viewed from firefox developer tools)
>>> > > <img width="300" height="150" src="data:image png;base64,
>>> > > ivborw0kggoaaaansuheugaaaciaaacwcayaaabncigqaaakukleqvr4no3d
>>> > zyoc1xkg4pcs+g5cvxdmamzoc=""
>>> > > bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesy
>>> > ksxlsmxhk0v1r6dpvff09h=""
>>> > > jzwmhattvvae7xfnqfoen...
>>> > >
>>> > > You can notice lots of ="" marks ="" splitting the string.
>>> > >
>>> > >
>>> > > Is this a wicket encoding issue or a javascript quirk?
>>> > >
>>> > > Thanks.
>>> > >
>>> > > **
>>> > > Martin
>>> > >
>>> > >
>>> >
>>>
>>
>>
>

Re: Question about ajax encoding/decoding, problem with image data url

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Really strange, works on same installation in simpler installation. No
difference in http traffic...

2017-05-03 18:07 GMT+03:00 Martin Makundi <
martin.makundi@koodaripalvelut.com>:

> Interesting, it works in a quickstart also on v1.4.
>
> Need to investigate more.
>
> 2017-05-03 17:20 GMT+03:00 Martin Grigorov <mg...@apache.org>:
>
>> I don't see any reason why this could break.
>> If you are able to reproduce it in a quickstart with 6.26/7.6 then please
>> create a ticket in JIRA.
>>
>> Check what is in the Ajax response, not what is in the DOM.
>> Also you can check with Google Chrome. Maybe Firefox does something funky.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Wed, May 3, 2017 at 4:11 PM, Martin Makundi <
>> martin.makundi@koodaripalvelut.com> wrote:
>>
>> > Here is a sample how it works in jsfiddle without problems:
>> > https://jsfiddle.net/#&togetherjs=0SQvHmm6Nj
>> >
>> > But when same content is in ajax update it breaks. Wonder what happens
>> to
>> > it before render?
>> >
>> > 2017-05-03 16:06 GMT+03:00 Martin Makundi <
>> > martin.makundi@koodaripalvelut.com>:
>> >
>> > > Hi!
>> > >
>> > > I am trying to display (wicket 1.4) an image using base64 image data
>> > > representation.
>> > >
>> > > For some reason the base64 gets garbled every time with ajax.
>> > >
>> > > For example:
>> > >
>> > > src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAA
>> > > CWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/
>> > > BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESY
>> > > kSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen....
>> > >
>> > > becomes (as viewed from firefox developer tools)
>> > > <img width="300" height="150" src="data:image png;base64,
>> > > ivborw0kggoaaaansuheugaaaciaaacwcayaaabncigqaaakukleqvr4no3d
>> > zyoc1xkg4pcs+g5cvxdmamzoc=""
>> > > bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesy
>> > ksxlsmxhk0v1r6dpvff09h=""
>> > > jzwmhattvvae7xfnqfoen...
>> > >
>> > > You can notice lots of ="" marks ="" splitting the string.
>> > >
>> > >
>> > > Is this a wicket encoding issue or a javascript quirk?
>> > >
>> > > Thanks.
>> > >
>> > > **
>> > > Martin
>> > >
>> > >
>> >
>>
>
>

Re: Question about ajax encoding/decoding, problem with image data url

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Interesting, it works in a quickstart also on v1.4.

Need to investigate more.

2017-05-03 17:20 GMT+03:00 Martin Grigorov <mg...@apache.org>:

> I don't see any reason why this could break.
> If you are able to reproduce it in a quickstart with 6.26/7.6 then please
> create a ticket in JIRA.
>
> Check what is in the Ajax response, not what is in the DOM.
> Also you can check with Google Chrome. Maybe Firefox does something funky.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, May 3, 2017 at 4:11 PM, Martin Makundi <
> martin.makundi@koodaripalvelut.com> wrote:
>
> > Here is a sample how it works in jsfiddle without problems:
> > https://jsfiddle.net/#&togetherjs=0SQvHmm6Nj
> >
> > But when same content is in ajax update it breaks. Wonder what happens to
> > it before render?
> >
> > 2017-05-03 16:06 GMT+03:00 Martin Makundi <
> > martin.makundi@koodaripalvelut.com>:
> >
> > > Hi!
> > >
> > > I am trying to display (wicket 1.4) an image using base64 image data
> > > representation.
> > >
> > > For some reason the base64 gets garbled every time with ajax.
> > >
> > > For example:
> > >
> > > src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAA
> > > CWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/
> > > BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESY
> > > kSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen....
> > >
> > > becomes (as viewed from firefox developer tools)
> > > <img width="300" height="150" src="data:image png;base64,
> > > ivborw0kggoaaaansuheugaaaciaaacwcayaaabncigqaaakukleqvr4no3d
> > zyoc1xkg4pcs+g5cvxdmamzoc=""
> > > bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesy
> > ksxlsmxhk0v1r6dpvff09h=""
> > > jzwmhattvvae7xfnqfoen...
> > >
> > > You can notice lots of ="" marks ="" splitting the string.
> > >
> > >
> > > Is this a wicket encoding issue or a javascript quirk?
> > >
> > > Thanks.
> > >
> > > **
> > > Martin
> > >
> > >
> >
>

Re: Question about ajax encoding/decoding, problem with image data url

Posted by Martin Grigorov <mg...@apache.org>.
I don't see any reason why this could break.
If you are able to reproduce it in a quickstart with 6.26/7.6 then please
create a ticket in JIRA.

Check what is in the Ajax response, not what is in the DOM.
Also you can check with Google Chrome. Maybe Firefox does something funky.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, May 3, 2017 at 4:11 PM, Martin Makundi <
martin.makundi@koodaripalvelut.com> wrote:

> Here is a sample how it works in jsfiddle without problems:
> https://jsfiddle.net/#&togetherjs=0SQvHmm6Nj
>
> But when same content is in ajax update it breaks. Wonder what happens to
> it before render?
>
> 2017-05-03 16:06 GMT+03:00 Martin Makundi <
> martin.makundi@koodaripalvelut.com>:
>
> > Hi!
> >
> > I am trying to display (wicket 1.4) an image using base64 image data
> > representation.
> >
> > For some reason the base64 gets garbled every time with ajax.
> >
> > For example:
> >
> > src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAA
> > CWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/
> > BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESY
> > kSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen....
> >
> > becomes (as viewed from firefox developer tools)
> > <img width="300" height="150" src="data:image png;base64,
> > ivborw0kggoaaaansuheugaaaciaaacwcayaaabncigqaaakukleqvr4no3d
> zyoc1xkg4pcs+g5cvxdmamzoc=""
> > bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesy
> ksxlsmxhk0v1r6dpvff09h=""
> > jzwmhattvvae7xfnqfoen...
> >
> > You can notice lots of ="" marks ="" splitting the string.
> >
> >
> > Is this a wicket encoding issue or a javascript quirk?
> >
> > Thanks.
> >
> > **
> > Martin
> >
> >
>

Re: Question about ajax encoding/decoding, problem with image data url

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Here is a sample how it works in jsfiddle without problems:
https://jsfiddle.net/#&togetherjs=0SQvHmm6Nj

But when same content is in ajax update it breaks. Wonder what happens to
it before render?

2017-05-03 16:06 GMT+03:00 Martin Makundi <
martin.makundi@koodaripalvelut.com>:

> Hi!
>
> I am trying to display (wicket 1.4) an image using base64 image data
> representation.
>
> For some reason the base64 gets garbled every time with ajax.
>
> For example:
>
> src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAA
> CWCAYAAABNcIgQAAAKUklEQVR4nO3dzYoc1xkG4PcS+g5cVxDmAmzoC/
> BCm5BANrMIWXilCwgIvIl3hhC8CUYbe+WFcAgJWdgT8MI2xjEYjA0KGYSjmESY
> kSxLsmXHk0V1R6dPVff09H/JzwMHaTTVVae7xfnqfOen....
>
> becomes (as viewed from firefox developer tools)
> <img width="300" height="150" src="data:image png;base64,
> ivborw0kggoaaaansuheugaaaciaaacwcayaaabncigqaaakukleqvr4no3dzyoc1xkg4pcs+g5cvxdmamzoc=""
> bcm5banrmiwxilcwgivil3hhc8cuybe+wfcagjwdgt8mi2xjeyja0kgysjmesyksxlsmxhk0v1r6dpvff09h=""
> jzwmhattvvae7xfnqfoen...
>
> You can notice lots of ="" marks ="" splitting the string.
>
>
> Is this a wicket encoding issue or a javascript quirk?
>
> Thanks.
>
> **
> Martin
>
>