In some cases, we need to pass parameters of Chinese characters via url. ColdFusion provides the URLEncodedFormat tag for the usage of url encoding. Under certain circumstances, it works with Chinese characters passing.

Successfully passing Chinese characters cases are listed below:
1.Passing values via a submitted form.
2.Passing values via a hyperlink, ﹝e.g. result.cfm?jobname=秘書﹞.

Case failed in passing Chinese characters is:
Using Javascript functions to open a popup window with encoded parameters in the URL.
﹝e.g. popUpCenteredWindow('result.cfm?jobname=秘書','newWin')﹞
Things are going wrong while js processing the encoded parameters and translate those parameters into some other characters which are unrecognizable.

The solution of this problem is to encode parameters inside the js script using "encodeURI()" function, which seems like using UTF-8 charset, and then decode the encoded values in destination pages. Therefore we can now make it effective again.
創作者 swangs 的頭像


swangs 發表在 痞客邦 留言(0) 人氣()