問題描述
我的頁面是utf-8編碼
目標頁面是EUC-JP編碼
即使已經設置了accept-charset="EUC-JP",提交後IE 和 Edge下還是亂碼
解決方案:
1. isIE方法中不僅判斷IE,還判斷Edge
<SCRIPT> function isIE() { //ie? if (!!window.ActiveXObject || "ActiveXObject" in window || navigator.userAgent.indexOf("Edge") > -1) return true; else return false; } </SCRIPT> <form action="http://www.smpho.com/shop/shopbrand.html" method="post" name="search" accept-charset="EUC-JP" onsubmit="if(isIE())document.charset='EUC-JP'"> <input name="search" size="20" class="search_input"> <button type="submit">検索する</button> </form>