Search code examples
urlurl-encodingw3c-validationdouble-quotes

Invalid quotes in URL


On our website, we are using JSON in location.hash. That means we need to use quotes in the URL as for instance:

https://goout.net/cs/jine-akce/3-2-1-jedem/qmnub/#"T":"2017-03-15T20:00:00"

The problem is that the W3C validator is not happy about it.

All the browsers handle the URL well, so I wonder if the validator is too strict or my URL is wrongly escaped?


Solution

  • Quotes are not allowed in the fragment part of a URL, so you have to percent-encode it with %22:

    https://goout.net/cs/jine-akce/3-2-1-jedem-impro-talk-show-s-cestovatelem-danem-pribanem/qmnub/#%22T%22:%222017-03-15T20:00:00%22
    

    List of valid characters in the URL fragment part: List of valid characters for the fragment identifier in an URL?