2011-01-27 67 views
-1

我有一个字符串\ u0025A3 \ u0025A3 ... e.t.c.那么我怎么能解码到在C#中的普通视图。C#和字符解码

我的意思是sequence \ u0025A3 \ u0025A3应该在解码模式下看起来。例如,\ u0025A3 \ 3A3序列应该看起来像“::”。

谢谢。

+1

你是什么意思的正常看法? – 2011-01-27 05:42:15

回答

0

您可以使用split方法来解码您的字符串。

0

字符串中的Unicode字符在\ uFFFF之上,因此它们将显示为“?”在默认的Windows字符集中,或在某些应用程序中使用“”。无论如何请试试这个。

string test = "\\u0025A3\\u0025A3"; 
Regex rx = new Regex(@"\\[uU]([0-9A-F]{6})"); 
test = rx.Replace(test, match => char.ConvertFromUtf32(int.Parse(match.ToString().Substring(2), NumberStyles.HexNumber)));