yeahdongcn / RSBarcodes

1D and 2D barcodes scanner and generators for iOS7 with delightful controls.
MIT License
383 stars 59 forks source link

Barcode Image generation Failed. #11

Closed zackhsuan closed 10 years ago

zackhsuan commented 10 years ago

Hey

Thanks for your regular updates with this awesome lib. I have just encountered a bug. Say a barcode like this one: SLE00725088463420131227 will have a problem when generating barcode image from it. I believe the code type is code128.

Could you please look into the issue? I have actually credited your lib in my app :) Nearly finished but awaiting for a couple of introduction screens. I will update with me when my app got released.

Cheers Zac

yeahdongcn commented 10 years ago

I tried to reproduce your problem but actually it's working.

zackhsuan commented 10 years ago

Thank you for your quick reply.

here are my inputs:
barcode = "\aSLE00725088463420131227"; barcodeType = "org.iso.Code128";

maybe something wrong when scanning the barcode?

looks like the scanner result is: Type: org.iso.Code128, value: ??SLE00725088463420131227

the ?? are actually the upside-down question mark. (couldn't type them)

yeahdongcn commented 10 years ago

‘\a’ will be recognized as a single invisible character in NSString, @"" and length=1 this character is not included in the code 128 encoding table (http://www.barcodeisland.com/code128.phtml), so generating is not working for this string. I've added character check in - (BOOL)isContentsValid:(NSString *)contents to avoid bad access crash. I think it's better to trim those invisible character before encoding them.

KevinJue commented 7 years ago

'im actually have the same problem with EAN13 barcode "2011101286925"

how did you fix you problem ?

zackhsuan commented 7 years ago

@KevinJue Sorry can't really recall what happened back then. :(