由于zxing的encoder默认使用iso-8859-1编码,如果不修改源,需要将字符编码转换
以zxing2.2为例
using ZXing;
using ZXing.Common;
using ZXing.Rendering;
。。。。。。。
生成二维码
string sEncode = “utf-8” //---或者gb2312
string EncoderContent = GetEncodingString(txtEncoderContent.Text,sEncode);
BarcodeWriter writer = new BarcodeWriter
writer.Format = BarcodeFormat.QR_CODE;
writer.Options.Height = 100;
writer.Options.Width = 100;
writer.Options.Margin = 0;
writer.Options.PureBarcode = true;
//---picturebox
picEncodedBarCode.Image = writer.Write(EncoderContent);
//----转换编码
private string GetEncodingString(string srcString,string sEncode)
{
Encoding e8859Encode = Encoding.GetEncoding("iso-8859-1");