Update UrlGenerator.php

Fix original proposal for allowing better escaping in paths.