日期:2014-05-18  浏览次数:20579 次

疤痕贴这样的码怎么转成汉字?
疤痕贴 
这样的码怎么转成汉字? 
我有一个数据库里全是这样的码,能在网页里显示成汉字,但是我想搜索,必须得在代码里强制把那些码转换成汉字,怎么换,有什么函数可以换

------解决方案--------------------
在web.config里面加上,GB2132的那个设置
------解决方案--------------------
System.Web.HttpUtility.HtmlDecode
------解决方案--------------------
顶下
------解决方案--------------------
string result= HttpUtility.HtmlDecode("疤痕贴");
------解决方案--------------------
char result=(char)30116;
------解决方案--------------------
(int)'字符' 
把字符转为数字,查代码点,注意是单引号。 
如: 
Response.Write((int)'中'); //结果为中字的代码:20013 
(char)代码 
把数字转为字符,查代码代表的字符。 
如: 
Response.Write((char)22269); //返回“国”字。
------解决方案--------------------
探讨
string result= HttpUtility.HtmlDecode("疤痕贴");

------解决方案--------------------
学习了,System.Web.HttpUtility.HtmlDecode 很好,很实用!
------解决方案--------------------
直接用Response.Write("疤痕贴");写出来就可以了