It's very strange that I found the messy code.I 've never seen this before.

this is the java code:

    /**
* list
*
* @throws UnsupportedEncodingException
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list(Long adminId, String operation, Date beginDate,
Date endDate, Pageable pageable, ModelMap model)
{
if (null == endDate)
{
endDate = new Date();
} //query 30day before by default
if (null == beginDate)
{
beginDate = DateUtils.addDays(endDate, -);
}
List<LogConfig> logConfigs = logConfigService.getAll();
List<Admin> admins = adminService.findAll();
model.addAttribute("admins", admins);
model.addAttribute("logConfigs", logConfigs);
model.addAttribute("adminId", adminId);
model.addAttribute("page", logService.findPage(adminId, operation,
beginDate, endDate, pageable));
model.addAttribute("operation", operation);
model.addAttribute("beginDate", beginDate);
model.addAttribute("endDate", endDate);
return "/admin/log/list";
}

And the String parameter "operation" was always messy code.

I thought it was the matter of FreeMarker. If the front end code gave a String as a object.so background program would got a address of object.

but that is wrong.It is just different with the messy code.

Finally I added this two lines code:

        if (operation != null)
{
operation = (new String(operation.getBytes("ISO-8859-1"), "utf-8"))
.trim();
}

that's ok.

but that's not the best way.

tomcat's encoding setting is the key of the problem.

Chinese Messy Code of String的更多相关文章

  1. Messy Code in Windows Server 2008 R2 English Edition

          We always use Windows Server 2008 R2 English operation system. And it doesn't have any problem ...

  2. the solution about &quot;messy code&quot; in elicpse

    I use the Elicpse IDE to develope the ansdroid app.Sometime encounter the messy code in the Elicpse ...

  3. .net 中文显示乱码问题(Chinese display with messy code)

    Case:同样的代码,本地开发环境(local is Chinese Simplify)可以成功运行,但是放到Windows Server 2008 R2(Local is United State) ...

  4. UVa——1593Alignment of Code(string重定向+vector数组)

    UVA - 1593 Alignment of Code Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & ...

  5. C++ code:string stream(string流)

    如果有一个文件aaa.txt,有若干行,不知道每行中含有几个整数,要编程输出每行的整数之和,该如何实现? 由于cin>>不能辨别空格与回车的差异,因此只能用getline的方式逐行读入数据 ...

  6. 【Leet Code】String to Integer (atoi) ——常考类型题

    String to Integer (atoi) Total Accepted: 15482 Total Submissions: 106043My Submissions Implement ato ...

  7. [PHP] find ascii code in string

    if (strpos($data ,chr(0x95)) !== false) { echo 'true'; }else{ echo "false"; }

  8. BNU OJ 50998 BQG's Messy Code

    #include <cstdio> #define _(l) int l #define ___(l,L) for (_(o)=0,x=l o*2;o<x;o++)O= L o; # ...

  9. IS Kali: installed chiess messy code problem

    apt-get install ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy init 6

随机推荐

  1. BZOJ 2096 Pilots - 单调队列STL(deque)

    传送门 分析: 单调队列:维护两个递增.递减的队列,每次都加入新元素并更新,如果最大值(递减队首)-最小值(递增队首) > k,那么将最左段更新为前面两者中较前的那一个,并弹掉.用deque可以 ...

  2. C++ public、protected、private 继承方式的区别

    访问修饰符 public.protected.private,无论是修饰类内成员(变量.函数),还是修饰继承方式,本质上实现的都是可见性的控制. Difference between private, ...

  3. iOS app审核参考信息地址

    发件人:(苹果开发支持邮箱地址) 中国区电话:400-670-1855 chinadev<chinadev@asia.apple.com>   您好: 感谢您与 Apple 开发者计划支持 ...

  4. 基于Linux应用层的6LOWPAN物联网网关及实现方法

    本发明涉及一种基于Linux应用层的6LOWPAN物联网网关及实现方法,所述物联网网关包括开发平台以及无线射频模块,其实现方法是:所述6LOWPAN物联网网关的以太网网口收到访问6LOWPAN无线传感 ...

  5. TensorFlow 学习(四)—— computation graph

    TensorFlow 的计算需要事先定义一个 computation graph(计算图),该图是一个抽象的结构,只有在评估(evaluate)时,才有数值解,这点和 numpy 不同.这张图由一组节 ...

  6. 【77.39%】【codeforces 734A】Anton and Danik

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  7. cordova插件整理

    原文:cordova插件整理 1.获取当前应用的版本号 cordova plugin add cordova-plugin-app-version 2.获取网络连接信息 cordova plugin ...

  8. ubuntu 下 caffe 的安装

    官方下载说明:Caffe | Installation: Ubuntu 在 ubuntu 的一些较新版本中(14.04 以上),caffe 的所有依赖包都可以使用 apt-get 大法搞定. 1. 依 ...

  9. yii2.0保留CSS样式的引入

    <link rel="stylesheet" href="http://cdn.staticfile.org/twitter-bootstrap/3.2.0/css ...

  10. 基于Geoserver发布时间地图

    Geoserver它是著名的开源GIS其中软件. 地图服务软件也经常使用的物品.基于geoserver和Openlayers它可以建立一个自由的,开放源码GIS工程. Geoserver公布地图的步骤 ...