这是我的Jsp页面:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
 <body>
<%
String msg="206_John_help i m in trouble,delhi,อินเดีย_30.64741430_76.817313799";
String result = java.net.URLEncoder.encode(msg, "UTF-8");
System.out.println("The msg is "+result);
String result1=java.net.URLDecoder.decode(result, "UTF-8");
System.out.println("The decoded msg is "+result1);

%>
</body>
</html>


输出是206_John_help我遇到麻烦了,德里,??????? _ 30.64741430_76.817313799

我总是得到??????而不是泰国字母。解码时如何获取泰文字母?

最佳答案

您可以尝试在顶部添加:

<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>


我认为这将解决问题。如果没有,您能给我们更多信息吗?

您正在使用日食吗?如果是,您是否正在Windows下进行开发?
在Windows中,默认情况下,eclipse与jsp和其他文件的WINDOWS CP1252编码一起使用。所写的文本可能是CP1252字符集。

在哪里运行tomcat和glashfish?视窗? Linux的?

09-18 21:04