Check the http-functional-test-with-query.xml (HttpFunctionalWithTestQueryTestCase). It has the # escaped:
This is due to URI format requirements.
One # sign still works for this test:
but not
Need to find the best place to escape those and unescape to make the URI constructor happy. Just FYI, ${} worked before there, so it was properly escaped, it seems.