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. APPCAN学习笔记002---app高速开发AppCan.cn平台特色

    技术qq交流群:JavaDream:251572072 1.多窗体机制   常见应用仅仅支持单一窗体 2.原生UI与交互支持   大量原生UI与交互支持(如Action Sheet等) 3.第三方开放 ...

  2. 【序列操作III】线段树

    题目描述 给出序列 a1,a2,…an(0≤ai≤109),有关序列的四种操作: 1. al,al+1,…,ar(1≤l≤r≤n)加上 x(-103≤x≤103) 2. al,al+1,…,ar(1≤ ...

  3. Cordova之如何用命令行创建一个项目(完整示例)

    原文:Cordova之如何用命令行创建一个项目(完整示例) 1. 创建cordova项目 (注意:当第一次创建或编译项目的时候,可能系统会自动下载一些东西,需要一些时间.) 在某个目录下创建cordo ...

  4. 利用WPF建立自己的3d gis软件(非axhost方式)(三)矢量数据显示控制

    原文:利用WPF建立自己的3d gis软件(非axhost方式)(三)矢量数据显示控制 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bPew 密 ...

  5. 5.1 入门整合案例(SpringBoot+Spring-data-elasticsearch) ---- good

    本节讲解SpringBoot与Spring-data-elasticsearch整合的入门案例. 一.环境搭建 新建maven项目,名字随意 pom.xml <parent> <gr ...

  6. scipy 图像处理(scipy.misc、scipy.ndimage)、matplotlib 图像处理

    from scipy.misc import imread / imsave / imshow imresize / imrotate / imfilter 1. scipy.misc 下的图像处理 ...

  7. Openstack+Kubernetes+Docker微服务实践

    Openstack+Kubernetes+Docker微服务实践 .....   Openstack+Kubernetes+Docker微服务实践之路--选型 posted @ 2016-11-15 ...

  8. ASP.NET Core 简介 - ASP.NET Core 基础教程 - 简单教程,简单编程

    原文:ASP.NET Core 简介 - ASP.NET Core 基础教程 - 简单教程,简单编程 ← ASP.NET Core 基础教程 ASP.NET Core Windows 环境配置 → A ...

  9. crossplatform---Nodejs in Visual Studio Code 02.学习Nodejs

    1.开始 源码下载:https://github.com/sayar/NodeMVA 在线视频:https://mva.microsoft.com/en-US/training-courses/usi ...

  10. WPF 实现水纹效果

    原文:WPF 实现水纹效果 鼠标滑过产生水纹,效果图如下:     XMAL就放置了一个img标签   后台主要代码 窗体加载: private void Window_Loaded(object s ...