The following small series for everyone to bring a C # to convert Unicode encoding to GB code instance. Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.
Examples are as follows:
public string Unicodetogb (string text) { System.Text.RegularExpressions.MatchCollection mc = System.Text.RegularExpressions.Regex.Matches (Text, "\\\\u ([\\w]{4})"); if (MC! = NULL && MC. Count > 0) { foreach (System.Text.RegularExpressions.Match m2 in MC) { string v = m2. Value; String word = v.substring (2); Byte[] codes = new byte[2]; int code = CONVERT.TOINT32 (Word. Substring (0, 2), (+); int code2 = Convert.ToInt32 (Word. Substring (2), (+); Codes[0] = (byte) code2; CODES[1] = (byte) code; Text = text. Replace (V, Encoding.Unicode.GetString (codes)); } } else { } return text; }