When reading JS files, I often encounter some Unicode-Encoded chinese characters. It is difficult to guess what Chinese is, so it is quite painful. Although online decoding and decoding tools are available, they are not very useful, especially for the Unicode decoder version 2.0. In a single breath, Google's decoding method can be achieved with only one C # Statement (original), as shown below:
Private string decodeunicode (string datastr)
{
RegEx Reg = new RegEx (@"(? I) \ [UU] ([0-9a-f] {4 })");
Return Reg. replace (datastr, delegate (Match m) {return (char) convert. toint32 (M. groups [1]. value, 16 )). tostring ();});
}
Although I won't use C #, I ran it after installing vs2008.Code, Passed the test. To avoid future pain, compile it into an EXE and share it with you.
The function is simple. Enter the unicode encoded content and click decode to automatically restore it to a readable Unicode code. As follows:
: Http://sharesh.googlecode.com/files/deunicode.zip