乱码问题
大宇_ 2008-05-19 04:37:18 不在web.config中设置requestEncoding="gb2312" ,服务器控件提交数据中文为乱码,怎么转化
例如在textbox"输入中国留学生普遍存在英语语言基础薄弱" 乱码为"йѧձӢԻ"
1.<META http-equiv="content-type" content="text/html; charset=gb2312"> 试过不行
2.HttpUtility.UrlDecode(中文, System.Text.Encoding.GetEncoding("gb2312"))也不行
3.用了方法如下,还是不行
static public string EnCodeBase64(string code_type, string code)
{
string encode = "";
if (code_type == null)
{
code_type = "unicode";
}
if (code != null && code.Length > 0)
{
byte[] bytes = System.Text.Encoding.GetEncoding(code_type).GetBytes(code);
try
{
encode = Convert.ToBase64String(bytes);
}
catch
{
//encode = code;
}
}
return encode;
}
请教正确答案