JS built-in functions (encodeuricomponent (); decodeuri () Implement Conversion Between Chinese and Uri
Example:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br/> <HTML xmlns = "http://www.w3.org/1999/xhtml"> <br/> <pead> <br/> <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8 "/> <br/> <title> untitled document </title> <br/> <MCE: Script Type =" text/JavaScript "> <! -- <Br/> function test () {<br/> var STR = document. getelementbyid ("srcstr "). value; <br/> var strtouri = encodeuricomponent (STR); <br/> document. getelementbyid ("strtouri "). innerhtml = strtouri; <br/> var uritostr = decodeuri (strtouri); <br/> document. getelementbyid ("uritostr "). innerhtml = uritostr; <br/>}< br/> // --> </MCE: SCRIPT> <br/> </pead> <br/> <body> <br/> <p> text to be converted: <br/> <input type = "text" id = "srcstr"/> <br/> </P> <br/> <p> <br/> uri code: <br/> <textarea Cols = "30" rows = "3" id = "strtouri">
Uri code to text: