16进制数据 -- 转换成中文

来源:互联网 发布:什么是020商业模式知乎 编辑:程序博客网 时间:2024/04/24 09:24

string a = "0152656420616E540000000000000000000041006400000000000000095B5265445D4E614461000000000000000148016400000000000000";

            byte[] bytes = new byte[a.Length / 2];

            int i = 0,r = 0;           
            while (i < a.Length)
            {
                bytes[r] = byte.Parse(a.Substring(i, 2), System.Globalization.NumberStyles.HexNumber);
                i += 2;
                r++;
            }

            string s = System.Text.Encoding.Default.GetString(bytes);
            Console.WriteLine(s);

原创粉丝点击