SharePoint "+"

Source: Internet
Author: User

It took me a long time to adapt to the new company. Now I am dedicated to service. Many SharePoint problems suddenly emerge, so I am overwhelmed ...... I will write down the solution of these problems later: This plus sign is not a new problem. I encountered a problem raised by many users. The problem occurs when a file or folder is accessed. Either ie crash or the file stored in a folder cannot be opened. These problems are caused by the "+" on the file, folder, or path. "+" Is converted to a space when the client requests a request to the server in the URL. It is a space. For example, you want to access a folder with the name "1 + 2". After conversion, the access address is changed from the original "1 space + 2 space" to "1 space, 2 space ", the result is yes. This folder does not exist. Of course, the contents of this address cannot be accessed, so an error will occur. At present, I suggest you replace or delete the "+" in the path to restore access to the file. Because the SharePoint URL is generated by ourselves, we cannot adjust or modify it by code, so we can only do so. Alternatively, add the method of adding the URL in the HTML of the current page to the dashboard page of SharePoint, and convert "+" to "% 2B ". The method can be referred here: http://sucre.blog.51cto.com/1084905/532231

 

 
 
  1. Special characters in the URL must be escaped.
  2.  
  3. 1. Replace space with the plus sign (+)
  4. 2. The forward slash (/) is used to separate directories and subdirectories.
  5. 3. Question mark (?) Separate URLs and queries
  6. 4. Specify special characters for the percent sign (% ).
  7. 5. # specifying bookmarks
  8. 6. & # separator Parameters

Causes of escape characters:

If your form is submitted using the get method and the submitted parameters contain special characters such, on the service end, the & parameter is treated as another parameter. For example
The form action is list. JSF? Act = Go & State = 5
Then, request. getparameter can be used to obtain the values of act and state.
If your intention is the act = 'go & State = 5' string, You must escape & to get the exact act value on the server.

Principles of URL escape characters:

Convert these special characters into ASCII codes in the format of % plus the ASCII code, that is, a percent sign %, followed by the ASCII (hexadecimal) value of the corresponding characters. For example, the Space Encoding value is "% 20 ".
 

 
 
  1. The URL special symbol and the corresponding hexadecimal value encoding:
  2.  
  3. 1. In the + URL, the plus sign indicates space % 2B
  4. 2. the space in the space URL can be + or encoded as % 20
  5. 3./separate directories and subdirectories % 2f
  6. 4 .? Separate the actual URL and parameter % 3f
  7. 5.% specify special characters % 25
  8. 6. # indicates bookmarks % 23
  9. 7. & separator between parameters specified in URL % 26
  10. 8. = value of the specified parameter in the URL % 3d

Solution ):

Method 1,Modify the client and replace "+" in the "+" parameter of the client with "+" with "2B %". Then, when the parameter is uploaded to the server, "+" is displayed.

Method 2,Modify the server side and replace the space with "+". This method is only applicable when the parameter contains "+" and no space.

Example:

 
 
  1. String a = reuqest.getParameter("clientStr").replace(' ','+'); 

If the client is clientstr = test + OK, the value of a is test + OK;

 

Method 3,Modify the server side, change the method for obtaining parameters from reuqest. getparameter to request. getquerystring (). substring (0), and parse the obtained string.

Example:

 
 
  1. String a =request.getQueryString().substring(0); 

If the client is clientstr = test + OK, then the value of A is clientstr = test + OK. You need to parse it again,

A = A. substring (10); The value of A is test + OK.

 

Appendix:A JavaScript code used to escape special characters in a URL.

 

 
 
  1. function URLencode(sStr)   
  2. {  
  3.     return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');  

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.