This article is a summary of the study on the web and its own little practice, thank you for your selfless sharing.
Yesterday in the project, there is a page between the need to pass special characters, looked up some information, now will own experience to write out.
First, code in the foreground
var fckpurpose=encodeuricomponent ($.trim (JQuery ("#fckPurpose"). Val ()));
The difference between encodeuricomponent, encodeURI, and escape three functions is the question of whether individual characters are encoded.
Reference:
Escape (), encodeURI (), encodeuricomponent () differences
Then the characters are processed in the background (Java) because there are some characters in Java that have special meanings
Fckpurpose = Fckpurpose.replaceall ("%", "%25"); fckpurpose = Fckpurpose.replaceall ("\\+", "%2b"); fckpurpose = Fckpurpose.replaceall ("/", "%2f"), Fckpurpose = Fckpurpose.replaceall ("\ \", "%3f"); fckpurpose = Fckpurpose.replaceall ("#", "%23"), Fckpurpose = Fckpurpose.replaceall ("&", "%26");
Special characters in the foreground of the conversion code, see: URL "+" plus the question
It's basically possible.
Passing special characters between pages of Java WEB