Enhance barcode format checking in isFormat06Code

Updated isFormat06Code method to handle additional barcode formats for compatibility with older Mouser parts and Eyoyo barcode scanners that don't omit the record separator character
This commit is contained in:
Marc 2026-03-19 14:53:04 +01:00 committed by GitHub
parent 753ecee849
commit b6e0473252
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -254,12 +254,16 @@ readonly class EIGP114BarcodeScanResult implements BarcodeScanResultInterface
*/
public static function isFormat06Code(string $input): bool
{
//Code must begin with [)><RS>06<GS>
if(!str_starts_with($input, "[)>\u{1E}06\u{1D}")){
return false;
//Code should begin with [)><RS>06<GS> as per the standard
if(!str_starts_with($input, "[)>\u{1E}06\u{1D}")
// some codes don't contain record separators
&& !str_starts_with($input, "[)>06\u{1D}")
// This is found on old Mouser parts
&& !str_starts_with($input, ">[)>06\u{1D}"))
{
return false;
}
//Digikey does not put a trailer onto the barcode, so we just check for the header
//Digikey and Mouser don't put a trailer onto the barcode, so we just check for the header
return true;
}