java Special Character Handling

 

 

 

 

// remove html tags rich text
 // <P> paragraph replaced linefeed 
Content = content.replaceAll (, "\ R & lt \ n-" "<P *.?>" );
 // <br> a Alternatively linefeed 
Content = content.replaceAll ( "<br \\ S * /?>", "\ R & lt \ n-" );
 // remove something else between <> 
Content = content.replaceAll ( "\\ < .? *> "," " ); 

// handle special characters lead to the json format incorrect 
content = Pattern.compile (" \\ s * | \ t | \ r | \ n ") matcher (content) .replaceAll. ( "" ); 

// % is a special character in a URL, you need to escape special about the solution: replace the use of 25% number% string 
content = content .replaceAll ( "% ( [0-9a-?! fA-F] {2}) ","% 25 ");

 

Guess you like

Origin www.cnblogs.com/ooo0/p/11359134.html