Junk characters are recognized from barcode image- which was generated using unicode/utf-8 string

Hi,

We tried to generate barcodes for unicode/utf-8 format strings. And during the recognition, junk characters were returned from the barcode reader. Refer to the URL: http://www.aspose.com/documentation/java-components/aspose.barcode-for-java/how-to-generate-and-recognize-barcodes-for-utf8-unicode-characters.html.

Some examples with UTF-8 and Pdf417 symbology:
original codetext: abc 华语/華語 xyz
recognized codetext: YH,C31e’c� xyz

original codetext: 华语/華語
recognized codetext: \bY D8\O語


This message was posted using Email2Forum by saqib.razzaq.

Hi,

I have logged this bug in our issue tracking system (ID: 14977). We will look into it and try to find the solution at our earliest. Sorry for the inconvenience.

Exotic information generating barcodes for unicode/utf-8 format strings,can be very helpful.Thanks for the recommendation.

Hi,

Please try with Aspose.BarCode for Java 2.1 for encoding/decoding Chinese language (UTF-8) characters. The sample code is also attached.

have a similar issue with decoding Polish characters

source: Spłata
output: SpÅ?ata
how do i fix this?

shwetank:
have a similar issue with decoding Polish characters

source: Spłata
output: SpÅ?ata
how do i fix this?

Replied at <a href="https://forum.aspose.com/t/27769</a>.<br>

Thanks!..sorry for posting a duplicate…wasn’t able to notice “new post” link earlier than this! :slight_smile:
have posted subsequent query to other link.

I believe it is a related issue - what I’ve noticed is that after encoding (via previous example) English letters and special characters (-/#$ etc.), saving to a memory stream and saving to an image produces different bar codes.


I can send you the code and examples used if you need them but it sounds like you’ve already identified a problem.

This was using the 3.5 version with datamatrix barcodes.

Hi
could you please post the analysis here? we’re using v2.1 barcode reader for java.

thanks!

Hi,


I follow the code in this page* to generate barcode with chinese character value, then read the image. I am not getting expected result. The value read is return as unrecognised characters.

Value: 这是一个传真
Result: "��Y�Yp�xA�yk�}�]yfP�"

I am using the latest release build of Aspose.Barcode.dll, etc.

Any idea?

I dont suppose you expect us to enforce the encoding for each barcode reading, because this will not work if there is a mixture of barcodes with different values, consist of ASCII string. unicode, double bytes chars, etc.

* http://www.aspose.com/docs/x/MoKl

Hi Praetorion,


Sorry for the delayed response.

I have worked with your scenario and I am afraid, I am unable to reproduce the said problem on my end by using the latest version of Aspose.BarCode for .NET v4.7.0. Please note if you are rendering the result in console window then you may have to do some extra processing to display Unicode characters otherwise such
characters will be rendered as ?. Alternatively, if you save the result in a txt file, you will notice the results are coming fine.

Please check the sample code as given below and the resultant txt file for your reference.

C#

Bitmap imgBarcode = null;
TextWriter result = null;
try
{
result = File.CreateText(“result.txt”);
// generate the barcode
BarCodeBuilder objBarCodeBuilder = new BarCodeBuilder();
objBarCodeBuilder.SymbologyType = Aspose.BarCode.Symbology.MacroPdf417;
// set the codetext by converting it into unicode byte array
byte[] byteArray = Encoding.Unicode.GetBytes(“这是一个传真”);
objBarCodeBuilder.SetCodeText(byteArray);
imgBarcode = objBarCodeBuilder.GenerateBarCodeImage();
imgBarcode.Save(“barcodes.png”);
// recognize the above barcode
BarCodeReader reader = new BarCodeReader(“barcodes.png”);
while (reader.Read())
{
Encoding unicode = Encoding.Unicode;
// get the characters array from the bytes
char[] unicodeChars = new char[unicode.GetCharCount(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length)];
unicode.GetChars(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length, unicodeChars, 0);
// build unicode string
string strCodeText = new string(unicodeChars);
result.WriteLine(strCodeText);
}
reader.Close();
result.Close();
}
catch (Exception ex)
{
System.Console.WriteLine(“No BarCode found”);

}

In case you have further inquiries, I would suggest you to create a new thread on this forum and post your problem. This way you will be notified instantaneously when a support member replies to your comments.

Regards,