private string UnicodeToGB(string content)
{
Regex objRegex = new Regex("&#(?<UnicodeCode>[\\d]{5});", RegexOptions.IgnoreCase);
Match objMatch = objRegex.Match(content);
StringBuilder sb = new StringBuilder(content) ;
while(objMatch.Success)
{
string code = Convert.ToString(Convert.ToInt32(objMatch.Result("${UnicodeCode}")),16);
byte[] array = new byte[2];
array[0] = (byte)Convert.ToInt32(code.Substring(2),16);
array[1] = (byte)Convert.ToInt32(code.Substring(0,2),16);
sb.Replace(objMatch.Value,Encoding.Unicode.GetString(array));
objMatch=objMatch.NextMatch();
}
return sb.ToString();
}
{
Regex objRegex = new Regex("&#(?<UnicodeCode>[\\d]{5});", RegexOptions.IgnoreCase);
Match objMatch = objRegex.Match(content);
StringBuilder sb = new StringBuilder(content) ;
while(objMatch.Success)
{
string code = Convert.ToString(Convert.ToInt32(objMatch.Result("${UnicodeCode}")),16);
byte[] array = new byte[2];
array[0] = (byte)Convert.ToInt32(code.Substring(2),16);
array[1] = (byte)Convert.ToInt32(code.Substring(0,2),16);
sb.Replace(objMatch.Value,Encoding.Unicode.GetString(array));
objMatch=objMatch.NextMatch();
}
return sb.ToString();
}