The toolbar of the extjs grid has a search box, if you enter Chinese search
Get in the background is garbled
String query = req.getParameter("query");
Find ext-4.2.1.883/examples/ux/form/SearchField.js
onTrigger2Click : function(){var me = this,
value = me.getValue();
if (value.length > 0) {
// Param name is ignored here since we use custom encoding in the proxy.
// id is used by the Store to replace any previous filter
me.store.filter({
id: me.paramName,
property: me.paramName,
value: encodeURI(value)
});
me.hasSearch = true;
me.triggerCell.item(0).setDisplayed(true);
me.updateLayout();
}
}
将 value:value改为value:encodeURI(value)
Get in the background: String query=URLDecoder.decode( req.getParameter( "query" ) ,"utf-8");
Because get requests the url,
Chinese characters are encoded once by the browser when requested,
2:http://127.0.0.1:8080/demo2/back/product/product/read.html?_dc=1385812888118&page=1&start=0&limit=12&name=%E9%9B%AA
Then you have to manually encode it once (encodeURI(value)),
3:http://127.0.0.1:8080/demo2/back/product/product/read.html?_dc=1385812761051&page=1&start=0&limit=12&name=%25E9%259B%25AA
Then the server side decodes it again, ( req.getParameter( "query" ); )
4:http://127.0.0.1:8080/demo2/back/product/product/read.html?_dc=1385812888118&page=1&start=0&limit=12&name=%E9%9B%AA
Then manually decode it again (URLDecoder.decode( req.getParameter( "query" ) ,"utf-8");)