Angular ui-router - Curly brackets etc in url

佐手、 提交于 2019-12-14 02:53:22

问题


I have been searching for a way to have curly brackets{} and slashes / in the URL. But the URL looks like this:

URL appearance now:
http://localhost/#/?ph=tes:testes%2Ftest%7Blb0%7D

URL wanted appearance:
http://localhost/#/?ph=tes:tests/test{lb0}

How do I get an URL without the %2f etc?

Thanks in advance!


回答1:


All valid characters that can be used in a URI (a URL is a type of URI) are defined in RFC 3986.

All other characters can be used in a URL provided that they are "URL Encoded" first. This involves changing the invalid character for specific "codes" (usually in the form of the percent symbol (%) followed by a hexadecimal number).

This link, HTML URL Encoding Reference, contains a list of the encodings for invalid characters.

Happy Helping!




回答2:


These (%2F, %7B) are escape sequences. They represent the special characters that are in your URL, as a URL cannot contain these character directly.

Where do you want exactly to process this URL?

You can use Javascript's unescape(url) to get the escaped URL string back to the original one if you're going to process it in Javascript itself.



来源:https://stackoverflow.com/questions/35204064/angular-ui-router-curly-brackets-etc-in-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!