A few days ago I asked the director under FreeMarker, Url how to code, I was thinking that "this requires coding it?"
Indeed, in most cases, the browser, the system framework can help us solve the problem of coding, even if no treatment is also without any problems, so I thought about such a scenario.
Js, then, it is to use the main encodeURIComponent, the path he would sign, Chinese encoded, so as not to conflict with the set of grammar Url
In Java has a similar syntax used to solve the Chinese path, space and other issues
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> asdad <a id="test" href="#">asdasd</a> <script type="text/javascript"> var ur = encodeURIComponent('a=http://www.baidu.com?a=这是一段中文&b=3'); console.log(ur) document.getElementById('test').setAttribute('href', 'http://localhost:8080/Sea/test?' + ur); </script> </body> </html>