The URL can’t display some special symbols, so the encoding will be used at this time. The encoding format is: a percent sign followed by the ASCII (hexadecimal) code value of the corresponding character. For example, the encoding value of a space is% 20. (ASCII reference)
some characters have special meanings in the URL, and the basic coding rules are as follows:
special meaning
hexadecimal value
1. + indicates empty space (spaces cannot be used in the URL)% 20
2/ Separate directory and subdirectory% 2F
3.?separate actual URL and parameter% 3F
4.% specify special character% 25
2 5. # indicates the separator% 26 between the parameters specified in the bookmark% 23
6. & amp; URL
For example: http://192.168.xxx.xxx/source/20190112 121000.txt
Note: such a URL cannot be successfully requested because the URL contains special words. The example URL contains special characters for spaces, so it needs to be converted to http://192.168.xxx.xxx/source/20190112%20121000.txt
Such a URL can request success.
Supplementary points:
Encoding and decoding functions of URL in Java java.net.URLEncoder . encode (string s) and java.net.URLDecoder . decode (string s);
URL encoding and decoding functions in JavaScript
escape (string s) and unescape (string s);
JavaScript
Read More:
- Implement base64_decode in GO language to solve the problem of illegal characters
- [Solved] LaTeX Error: \Url Error ->\url used in a moving argument.
- [Solved] MongoDB Error: FaileError: dToParse: Password must be URL Encoded for mongodb:// URL:
- Eclipse Tomcat Error creating bean with name ‘sqlSessionFactory’ defined in URL…
- Solve the VUE startup problem (You may use special comments to disable some warnings)
- [Solved] Spark Error: org.apache.spark.SparkException: A master URL must be set in your configuration
- The request was rejected because the URL contained a potentially malicious String “;” [How to Solve]
- The requested URL returned error: 403 [How to Solve]
- [Solved] CONDA error: Condahtterror: http 000 connection failed for URL
- The URL is timestamped to avoid caching problems when requesting the current path again
- [Solved] “HttpSendRequest“ failed, Windows error code=12002 andretry limit (0) exceeded for URL
- fatal: unable to access”: The requested URL returned error: 500
- [Solved] Error: condahtterror: http 404 not found for URL
- [step on the pit] idea submits the code to GitHub and prompts 403 — the requested URL returned error: 403
- [Solved] Event Log Error: Failed to retrieve application JMX service URL
- [Solved] Curl: (22) the requested URL returned error: 404 when installing XXX on MAC brew
- [Solved] Git push Warning: error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
- Error received: error: xhr’get’to URL cross domain [How to Solve]
- [Solved] ASP Website Error: An error occurred on the server when processing the URL.
- [Solved] java.lang.reflect.InaccessibleObjectException: Unable to make protected java.net.http.HttpRequest()…