By default, the text will be encoded in ANSI ecnoding sheme, you can use other encoding scheme, such as the UTF-8, UTF-16LE, UTF-16BE, etc.
For Delphi/C++ Builder 2007 or early:
Method 1, please convert the text to your encoding scheme, then assign it to the Barcode property of the barcode component, such as the TBarcode2D_QRCode, TBarcode2D_DataMatrixECC200, and the TBarcode2D_PDF417. The BOM may be placed depending on your application.
For example:
var BarcodeText: string;
....
BarcodeText := '....';
// The text is encoded in UTF-8 format, and the BOM is placed.
Barcode2D_QRCode1.Barcode := #$EF#$BB#$BF + AnsiToUTF8(BarcodeText);
Method 2, Please create the OnEncode event function for the barcode component, such as the TBarcode2D_QRCode, TBarcode2D_DataMatrixECC200, and the TBarcode2D_PDF417. In the event function, you can encode the UNICODE text in your encoding scheme. The BOM may be placed depending on your application.
For example:
var BarcodeText: string;
....
BarcodeText := '....';
Barcode2D_QRCode1.Barcode := BarcodeText;
....
procedure TForm1.Barcode2D_QRCode1Encode(Sender: TObject; var Data: sAnsiString; Barcode: string);
begin
// The text is encoded in UTF-8 format, and the BOM is placed.
Data := #$EF#$BB#$BF + AnsiToUTF8(Barcode);
end;
For Delphi/C++ Builder 2009 or later:
Method 1, please convert the text to your encoding scheme, then assign it to the Data property of the barcode component, such as the TBarcode2D_QRCode, TBarcode2D_DataMatrixECC200, and the TBarcode2D_PDF417. The BOM may be placed depending on your application.
For example:
// The text is encoded in UTF-8 format, and the BOM is placed.
var BarcodeText: string;
....
BarcodeText := '....';
Barcode2D_QRCode1.Data := #$EF#$BB#$BF + UTF8Encode(BarcodeText);
Method 2, Please create the OnEncode event function for the barcode component, such as the TBarcode2D_QRCode, TBarcode2D_DataMatrixECC200, and the TBarcode2D_PDF417. In the event function, you can encode the UNICODE text in your encoding scheme. The BOM may be placed depending on your application.
For example:
var BarcodeText: string;
....
BarcodeText := '....';
Barcode2D_QRCode1.Barcode := BarcodeText;
....
procedure TForm1.Barcode2D_QRCode1Encode(Sender: TObject; var Data: AnsiString; Barcode: string);
begin
// The text is encoded in UTF-8 format, and the BOM is placed.
Data := #$EF#$BB#$BF + UTF8Encode(Barcode);
end;