导出excel 时出现 类似这样的>  符号 , 大概是存到数据库也是这样,然后jsp解析可以解析出来,但是java不认得,需要个人写出解析方法。

废话不说,贴码:

/**
*转换html特殊符号。
* @param content 需要转换的html特殊符号
* @param defaultName 默认返回值
* @return 转化后实际的符号
*/
public static String transferHtml(String content, String defaultName) {
if(content==null) return defaultName;
String html = content;
html = StringUtils.replace(html, """, "\"");
html = StringUtils.replace(html, "&lt;", "<");
html = StringUtils.replace(html, "&gt;", ">");
html = StringUtils.replace(html, "&gt;", ">");
html = StringUtils.replace(html, "&sim;", "~");
html = StringUtils.replace(html, "&and;", "^");
html = StringUtils.replace(html, "&hellip;", "...");
return html;
}

StringUtils用的是apach的工具类

另外,我也找过度娘,对比了一下StringUtils的replace和String自带的replaceAll方法。

具体就参考http://blog.sina.com.cn/s/blog_8f99a1640102v6q2.html    这博主分析得挺不错的。

另外我也度了一下html特殊符号的对照表,具体参考 http://tool.chinaz.com/tools/htmlchar.aspx

总结:根据个人需要把某些常用的特殊符号解析添加到自己的项目中去。

最新文章

  1. 前端构建工具:gulp的配置与使用
  2. 也谈微信小程序
  3. EditPlus 3.7 中文版已经发布
  4. django1.9.6 使用 DjangoUeditor (python3.5)
  5. WebService 基础使用&amp;cxf第三方Service使用
  6. 为什么选择centos,而不是Dibian、Ubuntu【转】
  7. 在Java中怎样把数组转换为ArrayList?
  8. C++11 能好怎?
  9. 搜索(另类状态BFS):NOIP 华容道
  10. 20个命令行工具监控 Linux 系统性能(转载)
  11. Spring 详解第一天
  12. hdu2896
  13. @Scheduled(cron=&quot;&quot;) spring定时任务时间设置
  14. hdu 1236 1.3.2排名
  15. Binder机制,从Java到C (6. Binder in Native : libbinder)
  16. 兼容ie6及以上的阴影滤镜的写法
  17. Cms 总结(转)
  18. DIV+CSS中的滤镜和模糊
  19. 为什么使用 npm Scripts 构建项目
  20. tomcat 下配置 可 调试

热门文章

  1. CentOS(RedHat)命令行永久修改IP地址、网关、DNS
  2. hdu 5927 Auxiliary Set
  3. Groovy中文教程(链接收藏)
  4. IO 相关配置参数
  5. XmlHelper
  6. bom和dom总结
  7. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project LogTest: Compilation failure -&gt; [Help 1]
  8. Xcode6如何自己添加pch文件?
  9. Request和response的用法总结
  10. NSOperation的start与main,并发与非并发。