免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 4315 | 回复: 10

jsp在linux建立中文目录出现乱码!求大家帮忙!(已解决) [复制链接]

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-07-11 06:20:00
发表于 2007-06-07 20:06 |显示全部楼层
我在red hat AS4上 用jsp 建立中文目录,目录名都是乱码,请问各位该如何解决啊!

对您的帮助不胜感激!


[ 本帖最后由 meself_110 于 2007-6-8 13:17 编辑 ]

论坛徽章:
0
发表于 2007-06-07 20:16 |显示全部楼层
Can you describe in details how you do it?
As it might be caused by a lot of reasons.

Do you have these codes in your jsp?

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-07-11 06:20:00
发表于 2007-06-07 20:25 |显示全部楼层
我的linux系统语言是utf8,我把页面代码改成了下面的
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
还是乱码! 还有别的方法么?

论坛徽章:
0
发表于 2007-06-07 20:32 |显示全部楼层
Are you using tomcat?
If yes, then you still need to configure the following things at Tomcat level:

- Edit file <TOMCAT>/conf/server.xml under tag <Connector> to add URIEncoding="UTF-8" useBodyEncodingForURI="true".
- Edit file <TOMCAT>/bin/catalina.bat for Windows to add set CATALINA_OPTS = "-Dfile.encoding=UTF-8" or <TOMCAT>/bin/catalina.sh for Linux to add export CATALINA_OPTS = "-Dfile.encoding=UTF-8".

Besides, please ensure that your jsp file setting is set to UTF-8.
You may type in some chinese characters to test whether your file setting is set to UTF-8 or not. If you able to type and save it then its should be UTF-8 setting.

This is what I did previously and I managed display the chinese characters via jsp.

Hope this will help to solve your problem.

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-07-11 06:20:00
发表于 2007-06-07 20:55 |显示全部楼层
- Edit file <TOMCAT>/conf/server.xml under tag <Connector> to add URIEncoding="UTF-8" useBodyEncodingForURI="true".
中的<Connector> 是<Connector port=8080>这个么?

- Edit file <TOMCAT>/bin/catalina.bat for Windows to add set CATALINA_OPTS = "-Dfile.encoding=UTF-8"
这句话应该加在bin/catalina.bat 那里啊?

[ 本帖最后由 meself_110 于 2007-6-7 21:01 编辑 ]

论坛徽章:
0
发表于 2007-06-07 21:35 |显示全部楼层
<Connector port=8080> is the port which you used to access your application.
For example: http://192.168.1.111:8080/testApplication/jsp/index.jsp

You may add this: set CATALINA_OPTS = "-Dfile.encoding=UTF-8"
on the first line of the batch file.

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-07-11 06:20:00
发表于 2007-06-07 21:44 |显示全部楼层
谢谢 toms1981

- Edit file <TOMCAT>/conf/server.xml under tag <Connector> to add URIEncoding="UTF-8" useBodyEncodingForURI="true".

应该加在那里 是单独的建立一个 <Connector> 还是在原来已有的上面加上后面这句话?如果是在以有的上面加 应该加在那个tag <Connector> 里面呢?

再次谢谢!

论坛徽章:
0
发表于 2007-06-07 21:48 |显示全部楼层
add
URIEncoding="UTF-8" useBodyEncodingForURI="true"
to your existing connector tag

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-07-11 06:20:00
发表于 2007-06-07 21:54 |显示全部楼层
谢谢了!我明天实验下,今天得回去了.希望您明天有空的话,继续关注下这个帖子.对于您的帮助万分感谢!

论坛徽章:
0
发表于 2007-06-07 22:04 |显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP