惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
J
Java Code Geeks
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
U
Unit 42
B
Blog
宝玉的分享
宝玉的分享
腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
博客园 - Franky
博客园 - 三生石上(FineUI控件)
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
L
LangChain Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
博客园 - 叶小钗

博客园 - 单摆

MongoDB相关 [转]开源非关系型数据库Hibari发布 Solution to have multiple SSL sites on port 443 in IIS 清除MSSQL日志的方法 Flex学习相关 [转]travian建筑及资源升级所需资源的预测公式 【转】Travian]战斗伤亡计算——从入门到精通 网页游戏未来发展的一些趋势 【转】游戏开发商应开发网页游戏的电视版 【转】浅谈中国网页游戏分类 研究网页游戏几个重要的链接 2007年卓越雇主-网龙公司大量招人啦 代友招聘内网网络监控开发人员 晕,我的随笔也被盗用,还成了别人的专利了 信息检索的函数库Lucene的使用总结 使用Mencoder进行视频转换遇到的问题和相关解决方案 利用ffmpeg+mencoder视频转换的总结(C#) 策划已久的亿趣工作网今天终于上线了 无法更新Norton病毒库的原因
Unicode转汉字的实现
单摆 · 2007-06-01 · via 博客园 - 单摆

private string UnicodeToGB(string content)
        
{
            Regex objRegex 
= new Regex("&#(?<UnicodeCode>[\\d]{5});", RegexOptions.IgnoreCase);
            Match objMatch 
= objRegex.Match(content);
            StringBuilder sb 
= new StringBuilder(content) ;
            
while(objMatch.Success)
            
{
                
string code = Convert.ToString(Convert.ToInt32(objMatch.Result("${UnicodeCode}")),16);
                
byte[]   array  = new  byte[2];   
                array[
0]   =   (byte)Convert.ToInt32(code.Substring(2),16);   
                array[
1]   =   (byte)Convert.ToInt32(code.Substring(0,2),16); 

                sb.Replace(objMatch.Value,Encoding.Unicode.GetString(array));

                objMatch
=objMatch.NextMatch();
            }

            
return sb.ToString();
        }