Unicode encoding online conversion tool--javascript
I search on the Internet, see the use of JavaScript to do Unicode encoding conversion, feel very fun, so take to use.
This feature has been tested for both of the current:
1) Unicode converts each other, for example \u4e2d\u56fd to characters, and supports both Chinese and English;
2) URL encoding parsing, such as the well-known%20 is to represent the space, there are%24,%33,%44,%62 and so on;
I believe that as long as you try to decode the characters above, you will know the relationship between them, how to represent characters, numbers, and letters.
The above can be run directly. The following is the relevant JS code, as follows:
<script type= "Text/javascript" >//<! [Cdata[varDecToHex =function(str) {varres=[]; for(varI=0;i < str.length;i++) Res[i]= ("xx" +str.charcodeat (i). toString ()). Slice (-4); return"\\u" +res.join ("\\u");}varHextodec =function(str) {str=str.replace (/\\/g, "%"); returnunescape (str);}varBianma=function() {document.getElementById (' Code12 '). Value=dectohex (document.getElementById (' Code11 ')). value);}varJiema=function() {document.getElementById (' Code12 '). Value=hextodec (document.getElementById (' Code11 ')). value);}//]]></script><p><textarea id= "Code11" style= "width:500px; height:100px; "rows=" 5 "cols=" height= "></textarea> <br/><input onclick=" Bianma () "Type=" Button "value=" encoded "/> <input onclick=" Jiema () "type=" button "value=" Decode "/><br/><textarea Id= "Code12" style= "width:500px; height:100px, "rows=" 5 "cols=" ></textarea></p>
Source: http://www.cnblogs.com/skykang/archive/2011/06/02/2068802.html
Unicode encoding online conversion tool--javascript