Search code examples
phphtmlurlw3cw3c-validation

Weird output from W3Validator escaping URL


Morning all,

I'm fixing errors in a website and escaping a URL using lightbox prarameters is proving to be an heck of a task ... already tried it all but don't seem to be able to catch this one ...

And W3 Validator gives me this (the validator perceives the &, [ and ] chars):

 Error Line 130, Column 222: Bad value processa-watermark.php?id=TDJodmJXVXZhbUp0TDNCMVlteHBZMTlvZEcxc0wybHRZV2RsY3k5amIyNTBaWFZrYjNNdlNHVnlZbUZ5YVc4d015NXFjR2M9&lightbox[iframe]=true&lightbox[force]=image for attribute href on element a: Illegal character in query component.

 …e&amp;lightbox&lsqb;force&rsqb;=image"><img src="processa-imagem.php?src=TDJod…

  Syntax of IRI reference:
Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20. 

But on my code I have escaped those chars :

<div class="imagem imagemEsq">
<a class="lightbox" href="processa-watermark.php?id=TDJodmJXVXZhbUp0TDNCMVlteHBZMTlvZEcxc0wybHRZV2RsY3k5amIyNTBaWFZrYjNNdlNHVnlZbUZ5YVc4d01pNXFjR2M9&amp;lightbox&lsqb;iframe&rsqb;=true&amp;lightbox&lsqb;force&rsqb;=image"><img src="processa-imagem.php?src=TDJodmJXVXZhbUp0TDNCMVlteHBZMTlvZEcxc0wybHRZV2RsY3k5amIyNTBaWFZrYjNNdlNHVnlZbUZ5YVc4d01pNXFjR2M9&amp;zc=1&amp;w=350&amp;q=90" width="350" height="263" alt="Arquivos do Herbário" /></a>
</div>

The problem can very well also be in this block of code (it's another image)

<div class="imagem imagemDir">
<a class="lightbox" href="processa-watermark.php?id=TDJodmJXVXZhbUp0TDNCMVlteHBZMTlvZEcxc0wybHRZV2RsY3k5amIyNTBaWFZrYjNNdlNHVnlZbUZ5YVc4d015NXFjR2M9&amp;lightbox&lsqb;iframe&rsqb;=true&amp;lightbox&lsqb;force&rsqb;=image"><img src="processa-imagem.php?src=TDJodmJXVXZhbUp0TDNCMVlteHBZMTlvZEcxc0wybHRZV2RsY3k5amIyNTBaWFZrYjNNdlNHVnlZbUZ5YVc4d015NXFjR2M9&amp;zc=1&amp;w=250&amp;q=90" width="250" height="333" alt="Um livro de registos do Herbário" /></a>
</div>

Can anyone enlight me on this :/

Thanks in advance!


Solution

  • It should be:

    <div class="imagem imagemDir">
    <a class="lightbox" href="processa-watermark.php?id=TDJodmJXVXZhbUp0TDNCMVlteHBZMTlvZEcxc0wybHRZV2RsY3k5amIyNTBaWFZrYjNNdlNHVnlZbUZ5YVc4d015NXFjR2M9&amp;lightbox%5Biframe%5D=true&amp;lightbox%5Bforce%5D=image" width="250" height="333" alt="Um livro de registos do Herbário" /></a>
    </div>
    

    Reference: http://www.blooberry.com/indexdot/html/topics/urlencoding.htm