编码转换 [Inkit wiki]

用户工具

站点工具


g_tpr:codechange

编码转换

<html> <input type=“button” id=“btnf” onClick=“filt()” value=“提交”> <br> <input type=“text” id=“syntext” size=“70”> <script>

function filt() {

  var subtext=document.getElementById("syntext").value, unicode;
  unicode = GB2312UnicodeConverter.ToUnicode(subtext);
  document.getElementById("syntext").value=unicode;

}

      var GB2312UnicodeConverter = {
          ToUnicode: function (str) {
              return escape(str).toLocaleLowerCase().replace(/%u/gi, '\\u');
          }
          , ToGB2312: function (str) {
              return unescape(str.replace(/\\u/gi, '%u'));
          }
      };

</script> </html>

g_tpr/codechange.txt · 最后更改: 2023/04/04 18:02 由 127.0.0.1