Home >Java >JavaBase >Java url parameters are garbled

Java url parameters are garbled

尚
Original
2019-11-22 14:07:492537browse

Java url parameters are garbled

If the Chinese parameters of the URL are garbled, you can try:

Method 1: (java) The first page

Use when splicing URL parameters :URLEncoder.encode(parameter, "UTF-8")

The second page gets the parameter from the request

Value=new String(request.getParameter(parameter name).getBytes( "iso-8859-1"),"utf-8"); shopName = URLDecoder.decode(value, "UTF-8");

Method 2 (JavaScript)

Use directly encodeURI (Chinese)

Then you can get it directly in the background

For more java knowledge, please pay attention tojava basic tutorial.

The above is the detailed content of Java url parameters are garbled. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn