2016年4月25日 星期一

escape、encodeURI、endcodeURIcomponent

escape、encodeURI、endcodeURIcomponent

這些都是 Javascript 幫中文進行轉碼的語法

escape(String args), unescape(String args)


  • escape會處理 # 字 並轉化成 %23 並把空白轉換成  + 中文字處理為Unicode
  • 不會轉換的字符為 @ * / +


encodeURI(String  args) , decodeURI(String args)


  • encodeURI 不會處理 #字 會處理空白字  轉換為 %20 中文字處理為 UTF-8
  • 不會轉換的字符為 ! @ # $& * ( ) = : / ; ? + '


encodeURIComponent(String args),decodeURIComponent(String args)



  • encodeURIComponent 會處理 #字 轉換成%23 會處理空白字  轉換為 %20 中文字處理為 UTF-8
  • 不會轉換的字符為 ! *  () '




沒有留言:

張貼留言