kazuhikoarase / qrcode-generator

QR Code Generator implementation in JavaScript, Java and more.
https://kazuhikoarase.github.io/qrcode-generator/js/demo/
MIT License
2.1k stars 677 forks source link

Is there a way to manually set the mode to alphanumeric? #28

Closed enjoiful closed 7 years ago

enjoiful commented 7 years ago

Can I manually force the generator to encode data using Alphanumeric mode, instead of Binary mode?

I'm finding out that for a Version=2, DataCorrection=H, I can only fit 14 characters into the QR code. This is inline with the character limits for a "Binary" QR Code. However, I want to encode with Alphanumeric.

It looks like the generator only accepts Version and DataCorrection inputs, and does not allow you to specify mode (Binary, Alphanumeric, Kanji, Numeric). Am I missing something?

kazuhikoarase commented 7 years ago

I added a second parameter 'mode' to function addData. You can set one of 'Numeric', 'Alphanumeric', 'Byte', 'Kanji' explictly.

https://kazuhikoarase.github.io/qrcode-generator/

Thanks.

enjoiful commented 7 years ago

Works great, thanks!