现在的位置: 首页 > 综合 > 正文

GB2312 for Silverlight

2013年02月28日 ⁄ 综合 ⁄ 共 1351字 ⁄ 字号 评论关闭
Project Description
This class is for support GB2312 simplified Chinese characters for Silverlight(include Windows Phone 7) Application and inherited from Encoding abstract class. It's developed in CSharp.
这个类能够让 Silverlight(包含 Windows Phone 7)应用程序支持 GB2312 简体中文字符集,从 Encoding 抽象类继承。使用 C# 语言编写。
GB2312Encoding is fully implemented all Encoding functions therefore you can uses it as easy as system built-in Encoding features. In order to use the GB2312Encoding, you must embed an addition data file in your assembly.
Following features has been implemented:

  • Immediate decode array bytes and encode string or array chars
  • Simple use StreamReader and StreamWriter read and write stream


GB2312Encoding 类完整的实现了 Encoding 的所有功能,因此你可以很容易的实现所有的字符集编码功能。为了使用 GB2312Encoding,你必须嵌入一个附加的数据文件到你的程序集。
本程序实现了下列功能:

  • 解码字节数组和编码字符串或字符数组
  • 使用 StreamReader 和 StreamWriter 对流进行读写操作



Sample(例子):

WebClient _wc = new WebClient();
_wc.Encoding = new GB2312.GB2312Encoding();
_wc.DownloadStringCompleted += (ss, ee) => txtResult.Text = ee.Result;
_wc.DownloadStringAsync(new Uri(txtUrl.Text));

How to use:

Copy GB2312Encoding.cs and gb2312.bin files into your project and make sure:

  • gb2312.bin file’s build action is “Embedded Resource”
  • gb2312.bin filename correct(cannot modify filename)
  • GB2312Encoding.cs and gb2312.bin files in same folder

如何使用:

把 GB2312Encoding.cs 和 gb2312.bin 文件复制到你的项目并确保

  • gb2312.bin 文件的生成操作是“嵌入的资源”
  • gb2312.bin 文件的文件名正确(不能修改此文件名)
  • GB2312Encoding.cs 和 gb2312.bin 文件在同一个文件夹
  • 下载地址:http://gb2312.codeplex.com/

抱歉!评论已关闭.