DetectEncoding
BarcodeSettings.DetectEncoding property
De vlag die de engine dwingt om codetekstcodering voor Unicode-codesets te detecteren. Standaardwaarde is waar.
public bool DetectEncoding { get; set; }
Eigendoms-waarde
De vlag die de engine dwingt om codetekstcodering voor Unicode-codesets te detecteren
Voorbeelden
Dit voorbeeld laat zien hoe tekstcodering direct kan worden gedetecteerd als DetectEncoding is ingeschakeld
[C#]
using (MemoryStream ms = new MemoryStream())
{
using (BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, "Слово"))
{
generator.Parameters.Barcode.QR.CodeTextEncoding = Encoding.UTF8;
generator.Save(ms, BarCodeImageFormat.Png);
}
// detecteert codering voor Unicode-codesets is ingeschakeld
ms.Position = 0;
using (BarCodeReader reader = new BarCodeReader(ms, DecodeType.QR))
{
reader.BarcodeSettings.DetectEncoding = true;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
// codering detecteren is uitgeschakeld
ms.Position = 0;
using (BarCodeReader reader = new BarCodeReader(ms, DecodeType.QR))
{
reader.BarcodeSettings.DetectEncoding = false;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using ms As New MemoryStream
Using generator As New BarcodeGenerator(EncodeTypes.QR, "Слово")
generator.Parameters.Barcode.QR.CodeTextEncoding = System.Text.Encoding.UTF8
generator.Save(ms, BarCodeImageFormat.Png)
End Using
'detecteert codering voor Unicode-codesets is ingeschakeld
ms.Position = 0
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
reader.BarcodeSettings.DetectEncoding = True
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
'codering detecteren is uitgeschakeld
ms.Position = 0
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
reader.BarcodeSettings.DetectEncoding = False
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using
Zie ook
- class BarcodeSettings
- naamruimte Aspose.BarCode.BarCodeRecognition
- montage Aspose.BarCode