调用接口 返回的地址为\/apps\/\u6211\u7684\u5b58\u50a8\/1.jpg正常的应该是 ↓/apps/我的存储/1.jpg请问一下 中间的这个\u6211\u7684\u5b58\u50a8 怎么转换成 "我的存储"这几个正常的中文呢?
解决方案 »
- 用vs2008做了个登录界面,连接数据库,可是每次都登录失败,新手求教啊
- 关于"并非所有路径都返回值"
- c# 中自定义的方法怎样结束?
- 如何获得LISTVIEW最后点击的行
- c# & vb.net
- 有做过用execl生成一个模板,c#自动把数据填写到对应的模板内的么?
- C1FlexGrid的某一列的数据太长了,能换行显示吗
- 实现这样的遍历(文件操作)
- crystal report 9中可不可以动态生成报表,也就是说格式可以通过程序任意定制,望高手指点!
- NumericUpDown控件怎么加上limmet属性??
- Java和C#UDP通信问题
- C#中把多个DataSet取出的Tables组合在一起
str = Regex.Replace(str, @"\\u([\w]{2})([\w]{2})", a => {
byte[] bts = new byte[2];
bts[0] = (byte)int.Parse(a.Groups[2].Value, NumberStyles.HexNumber);
bts[1] = (byte)int.Parse(a.Groups[1].Value, NumberStyles.HexNumber);
return Encoding.Unicode.GetString(bts);
});
//\\/apps\\/我的存储\\/1.jpg
str = Regex.Replace(str, @"\\u([\w]{2})([\w]{2})", a => {
byte[] bts = new byte[2];
bts[0] = (byte)int.Parse(a.Groups[2].Value, NumberStyles.HexNumber);
bts[1] = (byte)int.Parse(a.Groups[1].Value, NumberStyles.HexNumber);
return Encoding.Unicode.GetString(bts);
});
// /apps/我的存储/1.jpg
public class UnicodeHelper
{
public static string Decode(string str)
{
Regex regex = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
return regex.Replace(str, delegate(Match m)
{
char ch = (char)Convert.ToInt32(m.Groups[1].Value, 0x10);
return ch.ToString();
});
}
}
string str2=UnicodeHelper.Decode(str);