Generate QR code, support Chinese

C# Code:

/// <summary>
/// Generate QR code, support Chinese
/// </summary>
/// <param name="data"> </param>
/// <returns> </returns >
private  static Image GenerateQRBarcode( string data)
{
   // Set the QR code specification
   ZXing.QrCode.QrCodeEncodingOptions qrEncodeOption =  newZXing.QrCode.QrCodeEncodingOptions();
   qrEncodeOption.CharacterSet = "UTF-8";  //Set the encoding format, Otherwise read 'Chinese' garbled
   qrEncodeOption.Height = 200;
   qrEncodeOption.Width = 200;
   qrEncodeOption.Margin = 2;  //Set the surrounding margins
   
   BarcodeWriter W =  new BarcodeWriter()
   ; (typeof(BarcodeFormat), BarcodeFormat.QR_CODE.ToString());
   W.Options = qrEncodeOption;
   
   return W.Write(data);
}

//来源:C/S框架网(www.csframework.com) QQ:1980854898

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325184891&siteId=291194637
Recommended