yeqown / go-qrcode

To help gophers generate QR Codes with customized styles, such as color, block size, block shape, and icon.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swedish letter in QR code

mishanon opened this issue · comments

commented

Try to generate QR code, try add Swedish letter and got wrong QR code (with red pixels LOL)
qr

generateQR("Övrigt asdasd asdas djaskl djaslk djaslkj dlaiodqjwiodjaskldj aksldjlk Övrigt")

    func generateQR(QRText string) {
        qrc, err := qrcode.New(QRText)
        if err != nil {
	        fmt.Printf("could not generate QRCode: %v", err)
        }
    
        // save file
        if err := qrc.Save("qr.png"); err != nil {
	        fmt.Printf("could not save image: %v", err)
        }
    }

what happened ... orz, give me some time to figure out

@mishanon after some tests, this bug would be triggered while input content is more than 74 characters, it's not related to the character set (Swedish), but I don't locate the bug in the source code yet. I will keep working on it. In my oppinion, it's version's bug...

@mishanon fixed in v1.5.2.

There is a bug while the raw content's length and error-correcting level require a higher version (6+):

  1. I didn't code all QR Code version alignment patterns.
  2. the function fillVersionInfo which works only version 7+ didn't work as QR Code specification.

By the way, this library didn't support Kanji encoding and all after it, https://en.wikipedia.org/wiki/QR_code#Encoding, but Byte encoding supports ISO-8859 character set which includes Swedish letters.

Thanks for your feedback.