惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Schneier on Security
Schneier on Security
N
Netflix TechBlog - Medium
IT之家
IT之家
MongoDB | Blog
MongoDB | Blog
博客园_首页
S
SegmentFault 最新的问题
H
Help Net Security
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
T
The Blog of Author Tim Ferriss
量子位
GbyAI
GbyAI
M
MIT News - Artificial intelligence
Recorded Future
Recorded Future
P
Privacy & Cybersecurity Law Blog
B
Blog
月光博客
月光博客
博客园 - 聂微东
Vercel News
Vercel News
罗磊的独立博客
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
Arctic Wolf
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale
L
Lohrmann on Cybersecurity
I
Intezer
小众软件
小众软件
T
The Exploit Database - CXSecurity.com
Jina AI
Jina AI
C
Check Point Blog
AWS News Blog
AWS News Blog
C
Cisco Blogs
Martin Fowler
Martin Fowler
The Last Watchdog
The Last Watchdog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
宝玉的分享
宝玉的分享
S
Security Affairs
大猫的无限游戏
大猫的无限游戏
N
News and Events Feed by Topic
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
H
Hacker News: Front Page
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
F
Full Disclosure
P
Proofpoint News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog

博客园 - dekn

如果做几十年的技术,不写点心得,是不是有点儿白瞎 如何修改tomcat内存大小 myeclipse中配置weblogic 9运行环境 解决无法向oracle中的long型字符插入大文本的问题 奇怪的JAVA字符集问题 让你的WEB程序同时支持FF与IE浏览器,经验积累 weblogic在处理jsp tag的scope属性时的BUG??? - dekn - 博客园 解决tomcat里中文文件无法正常下载 解决tomcat中rar、excel格式文件在下载时直接以乱码打开 test AJAX注意事项 WSAD与WebSphere中一步步配置JNDI 基于 Windows Mobile 的 Pocket PC 和 Smartphone 的开发工具简介 Windows CE .NET 应用程序开发:我有哪些选择? 开发 Windows Mobile 应用程序: FAQ 一天一个管理小故事 之二 《鲶鱼效应 》 一天一个管理小故事 之一 且慢下手 [原创]理解JNDI中 java:comp/env/jdbc/datasource 与 jdbc/datasource 的不同之处。 [详解]Linux的目录里都装些啥??
Tomcat中文问题小经验
dekn · 2006-07-12 · via 博客园 - dekn

一次开发中,遇到了很头大的中文问题,起初, 为了解决中文的参数传递问题,将/conf/server.xml中的编码设置为GBK,这时,中文的问题不存在了, 包括post  get数据也是正常的。 但是中文的文件却不能下载,每次访问中文的文件时,总是报“资源找不到”。 结果,在网上一查,有人说是将/conf/server.xml中的编码改成UTF-8。结果试了一下,果然OK。但这时,get方式提交表单或者URL中有中文时,又不能正常获取了。结果又改回到了GBK编码,通过以下方式解决中文文件下载的问题

<%
String fileUrl = java.net.URLEncoder.encode(search_result_info.getUrl(),"gbk");
fileUrl = cn.com.dekn.cms.util.StrUtil.replaceAll(fileUrl,"+"," ");
fileUrl = cn.com.dekn.cms.util.StrUtil.replaceAll(fileUrl,"%2F","/");
                               
%>
<a href="<%=fileUrl%>">

即使用 java.net.URLEncode 类对URL进行编码,编码为GBK, 而后在显示这个编码后的URL。 这个URL编码后,也baidu的方式是相同的。 但是JAVA的URLEncode将空格与/符号也进行了编码,似乎编码与浏览器采用的不一致,所以我在上面特别把空格与/去除,不对它们进行编码,编码后的 + 就是原先的空格,  %2F就是/ 。 后面打算继续彻底分析这个问题。 或者写一个适用的URLEncode类。