kazuhikoarase / qrcode-generator

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

Java version and UTF-8 German Umalauts #103

Open mubbo opened 2 years ago

mubbo commented 2 years ago

I've noticed with german Umalaut characters are not being correctly encoded in the Java version. They are being returned as "?". This is consistent with the javascript version when choosing multibyte SJIS and then using an umalute characters

üäöß

Is there someway I can set the multibyte encoding in the java version

Cheers and Thanks

Gary

kazuhikoarase commented 2 years ago

Hi, I fixed a little. Now you can use UTF-8. https://github.com/kazuhikoarase/qrcode-generator/commit/21a329f2c86023e9391d56ed1f0a35d9ea4c1d36 Thank you.

    final QRCode qr = new QRCode();
    QRCode.set8BitByteEncoding("UTF-8");
    qr.setTypeNumber(4);
    qr.addData("üäöß", Mode.MODE_8BIT_BYTE);
    qr.make();
    final BufferedImage img = qr.createImage(2, 2);
    ImageIO.write(img, "png", new File( "myQR.png") );

myQR