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

推荐订阅源

AI
AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
T
Tenable Blog
博客园_首页
S
Securelist
Spread Privacy
Spread Privacy
Google Online Security Blog
Google Online Security Blog
Forbes - Security
Forbes - Security
Engineering at Meta
Engineering at Meta
U
Unit 42
L
LINUX DO - 热门话题
量子位
T
Threat Research - Cisco Blogs
博客园 - 【当耐特】
C
Cyber Attacks, Cyber Crime and Cyber Security
K
Kaspersky official blog
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
Martin Fowler
Martin Fowler
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Security Latest
Security Latest
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
InfoQ
Know Your Adversary
Know Your Adversary
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
V2EX - 技术
V2EX - 技术
T
Tailwind CSS Blog
月光博客
月光博客
Recent Announcements
Recent Announcements
G
Google Developers Blog
F
Full Disclosure
W
WeLiveSecurity
宝玉的分享
宝玉的分享
腾讯CDC
G
GRAHAM CLULEY
Vercel News
Vercel News
Simon Willison's Weblog
Simon Willison's Weblog
美团技术团队
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security

博客园 - 可可果

Java Annotation手册 .NET环境下五种邮件发送解决方案(转载) C#中的事务处理 - 可可果 - 博客园 用commons-fileupload-1.2 实现文件上传(适用于Trubine框架) 用JAVA实现文本形式的树状结构显示(转) Google十大搜索技巧 Javascript导出Excel的方法 - 可可果 - 博客园 理解session机制 session的工作原理(转载) Session监听 button添加链接的方法 - 可可果 - 博客园 获得select控件的文本值的方法 - 可可果 - 博客园 清除缓存的方法 - 可可果 - 博客园 单例模式陷阱(转载) java模式中的单例模式(转载) - 可可果 - 博客园 解决用户意外退出在线列表无法及时更新问题(转载) Java开发中,试用hibernate建立关联时出现:not-null property references a null or transient value异常的原因 ListBox之间进行传值的脚本的例子,一般在添加权限,行业或者多项时可以用到 - 可可果 - 博客园 Velocity基本语法
Java中Excel导出时文件名乱码问题的解决
可可果 · 2007-12-10 · via 博客园 - 可可果

 1     /**
 2      *  把字符串转成utf8编码,保证中文文件名不会乱码
 3      * @param s
 4      * @return
 5      */
 6     public static String toUtf8String(String s){
 7         StringBuffer sb = new StringBuffer();
 8         for (int i=0;i<s.length();i++){
 9             char c = s.charAt(i);
10             if (c >= 0 && c <= 255){sb.append(c);}
11             else{
12                 byte[] b;
13                 try { b = Character.toString(c).getBytes("utf-8");}
14                 catch (Exception ex) {
15                     System.out.println(ex);
16                     b = new byte[0];
17                 }
18                 for (int j = 0; j < b.length; j++) {
19                     int k = b[j];
20                     if (k < 0) k += 256;
21                     sb.append("%" + Integer.toHexString(k).toUpperCase());
22                 }
23             }
24         }
25         return sb.toString();
26     }