metafloor / bwip-js

Barcode Writer in Pure JavaScript
Other
2.03k stars 295 forks source link

Swiss QR Code invalid for special characters #294

Closed baumschubser closed 1 year ago

baumschubser commented 1 year ago

Encoding Swiss QR Code format generates invalid QR codes if the value contains characters like ç. Fails in bwip-js, works in BWIPP.

This is the value:

SPC
0200
1
CH4431999123000889012
S
Verein ""Zum Beispiel""
Musterstrasse
123
8000
Seldwyla
CH

123.45
CHF
S
Prototype SA
Place de l'Exemple
2
25000
Besançon
FR
QRR
210000000003139471430009017
Gönnerbeitrag
EPD

Here is the QR code generated by bwip-js

In BWIPP:

(SPC^CR^LF0200^CR^LF1^CR^LFCH5800791123000889012^CR^LFS^CR^LFVerein ""Zum Beispiel""^CR^LFMusterstrasse^CR^LF123^CR^LF8000^CR^LFSeldwyla^CR^LFCH^CR^LF^CR^LF^CR^LF^CR^LF^CR^LF^CR^LF^CR^LF^CR^LF200.00^CR^LFEUR^CR^LFS^CR^LFModell Stiftung^CR^LFPostfach^CR^LF^CR^LF78462^CR^LFKonstanz^CR^LFDE^CR^LFSCOR^CR^LFRF18539007547034^CR^LFBesançon^CR^LFEPD^CR^LF^CR^LF^CR^LF) (mode=2 parse) /swissqrcode /uk.co.terryburton.bwipp findresource exec

Validate both QR codes here and you will find that bwip-js creates an error, saying it is not UTF-8, while the code from BWIPP is valid.

metafloor commented 1 year ago

Patch 3.4.1 has been released to fix the issue. The new version generates the same code words as BWIPP for your example.

baumschubser commented 1 year ago

Amazing response time, thank you very much for the quick fix and the very fast deployment.