Is a URL allowed to contain a space?

后端 未结 10 1272
慢半拍i
慢半拍i 2020-11-22 04:02

Is a URI (specifically an HTTP URL) allowed to contain one or more space characters? If a URL must be encoded, is + just a commonly followed convention

10条回答
  •  别跟我提以往
    2020-11-22 04:30

    URL can have an Space Character in them and they will be displayed as %20 in most of the browsers, but browser encoding rules change quite often and we cannot depend on how a browser will display the URL.

    So Instead you can replace the Space Character in the URL with any character that you think shall make the URL More readable and ' Pretty ' ;) ..... O so general characters that are preferred are "-","_","+" .... but these aren't the compulsions so u can use any of the character that is not supposed to be in the URL Already.

    Please avoid the %,&,},{,],[,/,>,< as the URL Space Character Replacement as they can pull up an error on certain browsers and Platforms.

    As you can see the Stak overflow itself uses the '-' character as Space(%20) replacement.

    Have an Happy questioning.

提交回复
热议问题