In an older version of Aspose.Barcode, we would turn strings into byte arrays and them pull them in with the .SetCodeText() function like this:
BarCodeBuilder objBarCodeBuilder = new BarCodeBuilder { EncodeType = EncodeTypes.DataMatrix };
byte[] byteArray = Encoding.Unicode.GetBytes(“منحة”);
objBarCodeBuilder.SetCodeText(byteArray);
…
I updated to v20.3.0 and transformed my code into the following. Unfortunately it errors out on cyrillic or arabic character sets. How can I change this code to handle more character sets?
protected byte[] EncodeBarCode(string BarCodeText)
{
BarCodeText = “منحة”;
//BarCodeText = “42 Answer To The Ultimate Question of Life, the Universe, and Everything”;
BarcodeGenerator objBarCodeBuilder = new BarcodeGenerator(EncodeTypes.DataMatrix, BarCodeText);
objBarCodeBuilder.Parameters.Barcode.DataMatrix.DataMatrixEncodeMode = DataMatrixEncodeMode.Full;
objBarCodeBuilder.Parameters.Barcode.XDimension.Pixels = 2;
imgBarcode = objBarCodeBuilder.GenerateBarCodeImage();
MemoryStream xStream = new MemoryStream();
imgBarcode.Save(xStream, System.Drawing.Imaging.ImageFormat.Png);
return xStream.ToArray();
}