0
我想构建一个包含查询字符串的URL,包含其他字符(在我的情况下是希伯来语)。 但是,当我的webapp收到请求时,提取的请求参数是gibrish ...构造URL查询字符串:字符集编码/解码
我该如何解决这个问题?
new URL("http://localhost:8080/SRV/page.jsp?param=" + URLEncoder.encode("heb text", "UTF-8")).openConnection();
目标页面:
<%
System.out.println("Receive: " + request.getParameter("param"));
%>
我使用的tomcat6,JDK6,Windows7的64
编辑:这是我的网页声明:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
您使用的是UTF-8字符集吗? –
欢迎来到SO。正如Le Guen所建议的,尝试在您的jsp中添加<%@ page contentType =“text/html; charset = UTF-8”%>并在网页中输出param。 –