URLEncoder.encode和encodeURIComponent的區別

背景介紹:前端

1)encodeURIComponent和decodeURIComponent在前端使用sql

2)URLEncoder.encode和URLDecoder.decode在後臺使用編程

知識點:ide

1)encodeURIComponent和URLEncoder.encode的區別在於前者對下面五個符號不編碼編碼

 spa

  1. ! %21
  2. ' %27
  3. ( %28
  4. ) %29
  5. ~ %7E

2)decodeURIComponent和URLDecoder.decode暫時還看不出有何區別code

解釋:it

先後臺交互傳輸數據的過程當中,若是含有!'()~,一樣的內容會傳輸不一樣的編碼結果,可是對方都能解碼。在具體應用時,若是有比較先後臺編碼的邏輯,最好測一下這幾個符號。若是編程環境已解決此問題最好,不然就要考慮一下修補之事了。class

相關文章
相關標籤/搜索