C# Code:
/// <summary>
/// 生成二维码,支持中文
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
private static Image GenerateQRBarcode(string data)
{
// 设置QR二维码的规格
ZXing.QrCode.QrCodeEncodingOptions qrEncodeOption = newZXing.QrCode.QrCodeEncodingOptions();
qrEncodeOption.CharacterSet = "UTF-8"; //设置编码格式,否则读取'中文'乱码
qrEncodeOption.Height = 200;
qrEncodeOption.Width = 200;
qrEncodeOption.Margin = 2; //设置周围空白边距
BarcodeWriter W = new BarcodeWriter();
W.Format = (BarcodeFormat)Enum.Parse(typeof(BarcodeFormat), BarcodeFormat.QR_CODE.ToString());
W.Options = qrEncodeOption;
return W.Write(data);
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898