Windows phone解决GB2312编码问题
时间:2014-11-24 18:56:05
收藏:0
阅读:180
环境win8+vse for Windows phone
在网站http://encoding4silverlight.codeplex.com/上点击下载
之后有三个文件big5.bin,DBCSEncoding.cs,gb2312.bin
将它们复制到项目文件夹中,在工程中右击选择"添加"---"新建文件夹",右击新建的文件夹,"添加"---"现有项",将那三个文件添加进去。
对于big5.bin,gb2312.bin,都右击,点"属性",在"生成操作"中选择"嵌入的资源"
对于DBCSEncoding.cs,右击,点"属性",在"生成操作"中选择"编译"
代码部分:
1 WebClient webClient = new WebClient(); 2 webClient.Encoding = DBCSCodePage.DBCSEncoding.GetDBCSEncoding("gb2312"); 3 webClient.DownloadStringAsync(new Uri("http://xxxx.xxxx.com.cn/s/201x-1x-2x/xxxx.html", UriKind.RelativeOrAbsolute));
评论(0)