url 传中文

mac2022-06-30  79

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方法中这么一搞,一了百了.

 

转载于:https://www.cnblogs.com/yanjunwu/p/4113442.html

最新回复(0)