Can't encode € symbol to Qr.
rasanfe opened this issue · 3 comments
If you try to encode the euro symbol (€) in a QR it makes it a question mark (?).
Can you post a code snippet here that you use for encoding?
Can you post a code snippet here that you use for encoding?
` public string BarcodeGenerate(string source, string outputFile, int height, int width, bool pureBarcode, int margin)
{
BarcodeWriter writer = new BarcodeWriter();
writer.Format = BarcodeFormat.QR_CODE;
writer.Options = new EncodingOptions
{
Height = height,
Width = width,
PureBarcode = pureBarcode,
Margin = margin,
};
var bitmap = writer.Write(source);
bitmap.Save(outputFile);
return outputFile;
}`
Sorry, spare free time. I couldn't answer any sooner.
With regard to the specification of QR codes, the ISO8859-1 character set is used. ISO8859-1 does not support the € symbol. You have to use ISO8859-15 or UTF-8.
public string BarcodeGenerate(string source, string outputFile, int height, int width, bool pureBarcode, int margin)
{
BarcodeWriter writer = new BarcodeWriter();
writer.Format = BarcodeFormat.QR_CODE;
writer.Options = new QrCodeEncodingOptions
{
Height = height,
Width = width,
PureBarcode = pureBarcode,
Margin = margin,
CharacterSet = ZXing.Common.StringUtils.UTF8
};
var bitmap = writer.Write(source);
bitmap.Save(outputFile);
return outputFile;
}