谁有现成的好的 UTF-8 转 GB2312 的C#代码
解决方案 »
- 弹出层中的GridView的分页
- GridView实现全选后台实现的问题是无法全选
- 将数据库中的字段的默认值设置为html时报错
- 这样把硬盘上的图片存进sql2005数据库?
- 求助!!!!!!!
- 密码提示强中弱是怎么计算的?
- 如何做到让下拉列表框获得焦点后就自动下拉分数不是问题
- 如何让textbox只接受数字?
- 请问如何在ASP.net的WEBFORM中使用WinSock控件啊?我想在客户端使用这个控件,谢谢
- 为什么string oo = dt.Rows[0][0].ToString();的值等于null?
- 提个简单问题,showModalDialog的。高手来解答一下
- 请问:asp.net除了做网站以外,还能做什么呀?
string gb2312info = string.Empty;Encoding utf8 = Encoding.UTF8;
Encoding gb2312 = Encoding.GetEncoding("gb2312");// Convert the string into a byte[].
byte[] unicodeBytes = utf8.GetBytes(utfinfo);
// Perform the conversion from one encoding to the other.
byte[] asciiBytes = Encoding.Convert(utf8, gb2312, unicodeBytes);
// Convert the new byte[] into a char[] and then into a string.
// This is a slightly different approach to converting to illustrate
// the use of GetCharCount/GetChars.
char[] asciiChars = new char[gb2312.GetCharCount(asciiBytes, 0, asciiBytes.Length)];
gb2312.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0);
gb2312info = new string(asciiChars);