if (null == keyword || keyword.equals("关键字")) keyword = "";
if(keyword.length()> 0 ){
boolean isEnChar = true;
for(int i = 0 ; i < keyword.length() ; i++){
int charIndex = keyword.charAt(i);
if(charIndex >= 19968){
isEnChar = false;
break;
}
}
if(isEnChar){
try {
keyword = new String(keyword.getBytes("iso-8859-1"),"utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
this.keyword = keyword;
在keyword的set方法中这么一搞,一了百了.