Valid characters for directory part of a URL (for short links)

后端 未结 2 1087
悲&欢浪女
悲&欢浪女 2020-11-29 00:03

Are there any other characters except A-Za-z0-9 that can be used to shorten links without getting into trouble? :)

I was thinking about +,;- or something.

Is

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 00:39

    According to RFC 3986 the valid characters for the path component are:

    a-z A-Z 0-9 . - _ ~ ! $ & ' ( ) * + , ; = : @
    

    as well as percent-encoded characters and of course, the slash /.

    Keep in mind, though, that many applications (not necessarily browsers) that attempt to parse URIs to make them clickable, for example, may support a much smaller set of characters. This is akin to parsing e-mail addresses where most attempts also don't catch all addresses allowed by the standard.

提交回复
热议问题