1. 程式人生 > >關於encodeURI兩次轉碼和非兩次轉碼,以及後臺中文,前臺不顯示問題總結

關於encodeURI兩次轉碼和非兩次轉碼,以及後臺中文,前臺不顯示問題總結

一:js:如果中文亂碼,就轉碼兩次

function details(cellValue,row){
		  return '<a href="#" onclick=openWindow('+row.executorId+',"'+encodeURI(encodeURI(row.executorName))+'")><font color="#6495ED">'+"詳情"+'</font></a>';	 
	 }

二:後臺中文前臺不顯示:

就用這個方法

       response.addHeader("Content-Disposition", "attachment;filename="+ java.net.URLEncoder.encode(fileName, "UTF-8"));