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. [Angular] Content Projection with ng-content

    For example there is tow form compoennts on the page, and what we want to do is reusing the form com ...

  2. #781 – 多个变换执行的顺序问题(Transform Order Matters)

    原文:#781 – 多个变换执行的顺序问题(Transform Order Matters) 原文地址:  https://wpf.2000things.com/2013/03/21/781-tr ...

  3. erlang app 文件

    http://hje.iteye.com/blog/1211734 应用的概念¶ 当我们写了实现特定功能的代码之后,我们可能想将代码转成一个 应用 (application),这是可以作为一个单元启动 ...

  4. VS2008智能提示解决办法

    最近在VS2008的代码编辑环境中,发现定义了一个类后,然后用类对象点不出对象的属性和方法,于是在网上参考一些资料. 具体步骤如下: 一.开始->Microsoft Visual Studio ...

  5. List&lt;Map&lt;String, String&gt;&gt; 开启 Map&lt;String, List&lt;String&gt;&gt;

    将List变成Map结构体,下面的文字是没有水平! 写作方法传送前土壤很长一段时间.我不知道有没有好的解决办法.我们也希望提供! Map<String, String> map1 = ne ...

  6. 【64.22%】【codefoces round 382A】Ostap and Grasshopper

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  7. Linux input

    Linux input 输入设备都有共性:中断驱动+字符IO,基于分层的思想,Linux内核将这些设备的公有的部分提取出来,基于cdev提供接口,设计了输入子系统,所有使用输入子系统构建的设备都使用主 ...

  8. 0-1分布(伯努利分布)、n 重伯努利分布(二项分布)

    1. 0-1 分布(伯努利分布) 0-1分布又名两点分布,或叫伯努利分布. P{X=k}=pk(1−p)1−k 其中 k=0,1. 伯努利分布未必一定是 0-1 分布,也可能是 a-b 分布,只需满足 ...

  9. WPF C# 多屏情况下,实现窗体显示到指定的屏幕内

    原文:WPF C# 多屏情况下,实现窗体显示到指定的屏幕内 针对于一个程序,需要在两个显示屏上显示不同的窗体,(亦或N个显示屏N个窗体),可以使用如下的方式实现. 主要涉及到的:System.Wind ...

  10. 机器学习:深入理解 LSTM 网络 (一)

    Recurrent Neural Network Long Short Term Memory Networks (LSTMs) 最近获得越来越多的关注,与传统的前向神经网络 (feedforward ...