Is the "&" symbol allowed in the PATH segment of an URL or should be escaped?
According to nu w3c validator (https://validator.w3.org/nu/) I got:
Error: & did not start a character reference. (& probably should have been escaped as &.)
At line 407, column 52
<a href="/Bags-&-Purses/c/wome
However if I try to encode the URL via Java URI class I got all spaces and etc encoded but not the & symbol.
URI u = new URI(request.getScheme(), null,
request.getServerName(), request.getServerPort(),
request.getContextPath() + url,
query, null);
u.toURL().toString();
Where url string was : /Bags-&-Purses/c/womens-accessories-bags
The result is : https://localhost:8112/storefront/Bags-&-Purses/c/womens-accessories-bags - not encoded
The question is why the & is not escaped.. is this valid ? I guess it should be escaped with %26 but it looks it doesn't get escaped.