A URL, the Uniform Resource Locator, is a common resource identifier URI.
Because a valid URI cannot contain certain characters, such as spaces, you cannot access a valid resource if the URI is not encoded using the corresponding encoding function (the browser handles the corresponding URL).
JavaScript's Global object (JavaScript's built-in object) has four URI methods, encodeURI and Decodeuri,encodeuricomponent and decodeURIComponent, respectively. The browser model (BOM) provides escape and unescape. In practice, the URI method is preferable because the URI method encodes all Unicode symbols, and the escape and unescape provided by the BOM encode only ASCII symbols. In addition, Escape,unescape can be used to encrypt and decrypt data.
Where encodeURI and decodeURI are treated in the opposite way, encodeURIComponent and decodeURIComponent are doing the opposite, and escape and unescape do the opposite treatment.
encodeURI is to process the complete URI, while the encodeuricomponent handles the URI fragment, encodeURI the encoding except:! , #,¥,&, ', (,), x,+,,,-,.,/,:,;,=,? , @,_,~,0-9,a-z,a-z (a total of 82) characters, while the encodeURIComponent code except:!, ', (,), *,-,.,_,~,0-9,a-z,a-z (total 71) characters, Escape coding except: *,+,-, .,/,@,_,0-9,a-z,a-zs (a total of 61) characters.
The request server (server is a 64-bit operating system) end with a special character (+) of the file name, with encodeuri,decodeuricomponent or escape will prompt the corresponding resources do not exist, this is why?
JS Code:
Copy Code code as follows:
url = "Http://192.168.6.135/nas135/MyDocument/1+2.txt"
window.open (encodeURI (URL), "", "" "," ");
See through Debug
encodeURI (URL) = "Http://192.168.6.135/nas135/MyDocument/1%2b2.txt", but can not open server-side 1+2.txt files, do not know if it is because of the 64 machine reason? Would you please help me explain?